提交代码
This commit is contained in:
parent
8b402fd7c2
commit
d4e1cd4682
@ -62,7 +62,48 @@ class Index extends Backend
|
|||||||
protected $error_auth = false;
|
protected $error_auth = false;
|
||||||
|
|
||||||
protected $qSwitch = true;
|
protected $qSwitch = true;
|
||||||
protected $qFields = ["user_id"];
|
protected $qFields = ["user_id","name","address_detail","type","tel","legal_entity","shop_apply_id"];
|
||||||
|
|
||||||
|
|
||||||
|
protected function checkAssemblyParameters(){
|
||||||
|
if(!$this->qSwitch)return false;
|
||||||
|
//得到所有get参数
|
||||||
|
$get = $this->request->get();
|
||||||
|
//得到当前model所有字段
|
||||||
|
|
||||||
|
|
||||||
|
$fields = $this->shopModel->getTableFields();
|
||||||
|
|
||||||
|
// $commonFields = (new Field())->getCommonFields();
|
||||||
|
// var_dump($commonFields);
|
||||||
|
$fieldLists = $fields;
|
||||||
|
// foreach ($commonFields as $commonField) {
|
||||||
|
// if (!in_array($commonField['column_name'], $fields)) {
|
||||||
|
// $fieldLists[] = $commonField;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
$q_fields = [];
|
||||||
|
|
||||||
|
foreach ($get as $kay=>$getField) {
|
||||||
|
if (in_array($kay, $fieldLists) || in_array($kay, $this->qFields)) {
|
||||||
|
$q_fields[$kay] = $getField;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//将q_fields塞入模板中
|
||||||
|
foreach ($q_fields as $k=>$v) {
|
||||||
|
//渲染站点配置
|
||||||
|
$this->assign('q_'.$k, $v);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($this->qFields as $k) {
|
||||||
|
//渲染站点配置
|
||||||
|
if(!isset($q_fields[$k]))$this->assign('q_'.$k, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function _initialize()
|
public function _initialize()
|
||||||
@ -740,6 +781,7 @@ class Index extends Backend
|
|||||||
Admin::where(array('admin_shop_id'=>$row['shop_id']))->update(['admin_shop_id'=>0]);
|
Admin::where(array('admin_shop_id'=>$row['shop_id']))->update(['admin_shop_id'=>0]);
|
||||||
|
|
||||||
Evaluate::where(array('shop_id'=>$row['shop_id']))->delete();
|
Evaluate::where(array('shop_id'=>$row['shop_id']))->delete();
|
||||||
|
\app\common\model\manystore\ShopApply::where(array('shop_id'=>$row['shop_id']))->update(['shop_id'=>0,'store_id'=>0]);
|
||||||
if(!$result){
|
if(!$result){
|
||||||
exception('商家信息删除失败');
|
exception('商家信息删除失败');
|
||||||
}
|
}
|
||||||
|
73
application/admin/controller/manystore/ShopApply.php
Normal file
73
application/admin/controller/manystore/ShopApply.php
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\admin\controller\manystore;
|
||||||
|
|
||||||
|
use app\common\controller\Backend;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机构申请
|
||||||
|
*
|
||||||
|
* @icon fa fa-circle-o
|
||||||
|
*/
|
||||||
|
class ShopApply extends Backend
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ShopApply模型对象
|
||||||
|
* @var \app\admin\model\manystore\ShopApply
|
||||||
|
*/
|
||||||
|
protected $model = null;
|
||||||
|
|
||||||
|
public function _initialize()
|
||||||
|
{
|
||||||
|
parent::_initialize();
|
||||||
|
$this->model = new \app\admin\model\manystore\ShopApply;
|
||||||
|
$this->view->assign("typeList", $this->model->getTypeList());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||||
|
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||||
|
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
//当前是否为关联查询
|
||||||
|
$this->relationSearch = true;
|
||||||
|
//设置过滤方法
|
||||||
|
$this->request->filter(['strip_tags', 'trim']);
|
||||||
|
if ($this->request->isAjax()) {
|
||||||
|
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||||
|
if ($this->request->request('keyField')) {
|
||||||
|
return $this->selectpage();
|
||||||
|
}
|
||||||
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||||
|
|
||||||
|
$list = $this->model
|
||||||
|
->with(['user','shop'])
|
||||||
|
->where($where)
|
||||||
|
->order($sort, $order)
|
||||||
|
->paginate($limit);
|
||||||
|
|
||||||
|
foreach ($list as $row) {
|
||||||
|
|
||||||
|
$row->getRelation('user')->visible(['nickname','mobile','avatar']);
|
||||||
|
$row->getRelation('shop')->visible(['name','logo']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||||
|
|
||||||
|
return json($result);
|
||||||
|
}
|
||||||
|
return $this->view->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
20
application/admin/lang/zh-cn/manystore/shop_apply.php
Normal file
20
application/admin/lang/zh-cn/manystore/shop_apply.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'User_id' => '申请用户',
|
||||||
|
'Type' => '类型',
|
||||||
|
'Type 1' => '个人',
|
||||||
|
'Type 2' => '机构',
|
||||||
|
'Name' => '机构名称',
|
||||||
|
'Realname' => '联系人姓名',
|
||||||
|
'Mobile' => '联系电话',
|
||||||
|
'Address' => '机构|授课地址',
|
||||||
|
'Shop_id' => '申请的机构id',
|
||||||
|
'Create_time' => '创建时间',
|
||||||
|
'Update_time' => '修改时间',
|
||||||
|
'User.nickname' => '昵称',
|
||||||
|
'User.mobile' => '手机号',
|
||||||
|
'User.avatar' => '头像',
|
||||||
|
'Shop.name' => '店铺名称',
|
||||||
|
'Shop.logo' => '品牌LOGO'
|
||||||
|
];
|
83
application/admin/model/manystore/ShopApply.php
Normal file
83
application/admin/model/manystore/ShopApply.php
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\admin\model\manystore;
|
||||||
|
|
||||||
|
use think\Model;
|
||||||
|
|
||||||
|
|
||||||
|
class ShopApply extends Model
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 表名
|
||||||
|
protected $name = 'manystore_shop_apply';
|
||||||
|
|
||||||
|
// 自动写入时间戳字段
|
||||||
|
protected $autoWriteTimestamp = false;
|
||||||
|
|
||||||
|
// 定义时间戳字段名
|
||||||
|
protected $createTime = "create_time";
|
||||||
|
protected $updateTime = "update_time";
|
||||||
|
protected $deleteTime = false;
|
||||||
|
|
||||||
|
// 追加属性
|
||||||
|
protected $append = [
|
||||||
|
'type_text',
|
||||||
|
'create_time_text',
|
||||||
|
'update_time_text'
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function getTypeList()
|
||||||
|
{
|
||||||
|
return ['1' => __('Type 1'), '2' => __('Type 2')];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getTypeTextAttr($value, $data)
|
||||||
|
{
|
||||||
|
$value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
|
||||||
|
$list = $this->getTypeList();
|
||||||
|
return isset($list[$value]) ? $list[$value] : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getCreateTimeTextAttr($value, $data)
|
||||||
|
{
|
||||||
|
$value = $value ? $value : (isset($data['create_time']) ? $data['create_time'] : '');
|
||||||
|
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getUpdateTimeTextAttr($value, $data)
|
||||||
|
{
|
||||||
|
$value = $value ? $value : (isset($data['update_time']) ? $data['update_time'] : '');
|
||||||
|
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function setCreateTimeAttr($value)
|
||||||
|
{
|
||||||
|
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function setUpdateTimeAttr($value)
|
||||||
|
{
|
||||||
|
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function shop()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Shop::class, 'shop_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||||
|
}
|
||||||
|
}
|
27
application/admin/validate/manystore/ShopApply.php
Normal file
27
application/admin/validate/manystore/ShopApply.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\admin\validate\manystore;
|
||||||
|
|
||||||
|
use think\Validate;
|
||||||
|
|
||||||
|
class ShopApply extends Validate
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 验证规则
|
||||||
|
*/
|
||||||
|
protected $rule = [
|
||||||
|
];
|
||||||
|
/**
|
||||||
|
* 提示消息
|
||||||
|
*/
|
||||||
|
protected $message = [
|
||||||
|
];
|
||||||
|
/**
|
||||||
|
* 验证场景
|
||||||
|
*/
|
||||||
|
protected $scene = [
|
||||||
|
'add' => [],
|
||||||
|
'edit' => [],
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
@ -11,6 +11,9 @@
|
|||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div id="myTabContent" class="tab-content">
|
<div id="myTabContent" class="tab-content">
|
||||||
<div class="tab-pane fade active in" id="basic">
|
<div class="tab-pane fade active in" id="basic">
|
||||||
|
|
||||||
|
<input type="hidden" name="row[shop_apply_id]" value="{$q_shop_apply_id}" />
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="username" class="control-label col-xs-12 col-sm-2">{:__('Username')}:</label>
|
<label for="username" class="control-label col-xs-12 col-sm-2">{:__('Username')}:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
@ -78,7 +81,7 @@
|
|||||||
|
|
||||||
<select id="c-type" data-rule="required" class="form-control selectpicker" name="shop[type]">
|
<select id="c-type" data-rule="required" class="form-control selectpicker" name="shop[type]">
|
||||||
{foreach name="typeList" item="vo"}
|
{foreach name="typeList" item="vo"}
|
||||||
<option value="{$key}" {in name="key" value="2"}selected{/in}>{$vo}</option>
|
<option value="{$key}" {in name="key" value="$q_type"}selected{/in}>{$vo}</option>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -89,7 +92,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
|
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<input id="c-name" data-rule="required" class="form-control" name="shop[name]" type="text" value="" placeholder="请输入{:__('Name')}" >
|
<input id="c-name" data-rule="required" class="form-control" name="shop[name]" type="text" value="{$q_name}" placeholder="请输入{:__('Name')}" >
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@ -162,7 +165,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('Address_detail')}:</label>
|
<label class="control-label col-xs-12 col-sm-2">{:__('Address_detail')}:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<input id="c-address_detail" data-rule="required" class="form-control" name="shop[address_detail]" type="text" value="" placeholder="请输入{:__('Address_detail')}">
|
<input id="c-address_detail" data-rule="required" class="form-control" name="shop[address_detail]" type="text" value="{$q_address_detail}" placeholder="请输入{:__('Address_detail')}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@ -213,7 +216,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('Tel')}:</label>
|
<label class="control-label col-xs-12 col-sm-2">{:__('Tel')}:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<input id="c-tel" class="form-control" data-rule="required" name="shop[tel]" type="text" value="" placeholder="请输入{:__('Tel')}">
|
<input id="c-tel" class="form-control" data-rule="required" name="shop[tel]" type="text" value="{$q_tel}" placeholder="请输入{:__('Tel')}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -262,7 +265,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('Legal_entity')}:</label>
|
<label class="control-label col-xs-12 col-sm-2">{:__('Legal_entity')}:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<input id="c-legal_entity" class="form-control" name="shop[legal_entity]" type="text" value="">
|
<input id="c-legal_entity" class="form-control" name="shop[legal_entity]" type="text" value="{$q_legal_entity}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
75
application/admin/view/manystore/shop_apply/add.html
Normal file
75
application/admin/view/manystore/shop_apply/add.html
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="mobile" data-format-item="{id} - {nickname} - {mobile}" class="form-control selectpage" name="row[user_id]" type="text" value="0">
|
||||||
|
<!-- <span style="color: red">-->
|
||||||
|
|
||||||
|
<!-- (没找到用户则点击按钮创建用户后重新下拉框选用户)-->
|
||||||
|
<!-- <a data-url="user/user/changeuser" href="javascript:;" class="btn btn-success btn-changeuser {:$auth->check('user/user/changeuser')?'':'hide'}" title="根据手机号生成用户" ><i class="fa fa-plus"></i> 根据手机号生成用户</a>-->
|
||||||
|
|
||||||
|
<!-- </span>-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
|
||||||
|
<select id="c-type" data-rule="required" class="form-control selectpicker" name="row[type]">
|
||||||
|
{foreach name="typeList" item="vo"}
|
||||||
|
<option value="{$key}" {in name="key" value="2"}selected{/in}>{$vo}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Realname')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-realname" data-rule="required" class="form-control" name="row[realname]" type="text">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Mobile')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-mobile" data-rule="required" class="form-control" name="row[mobile]" type="text">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Address')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-address" class="form-control" name="row[address]" type="text">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="form-group">-->
|
||||||
|
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Shop_id')}:</label>-->
|
||||||
|
<!-- <div class="col-xs-12 col-sm-8">-->
|
||||||
|
<!-- <input id="c-shop_id" data-rule="required" data-source="manystore/shop/index" class="form-control selectpage" name="row[shop_id]" type="text" value="">-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- <div class="form-group">-->
|
||||||
|
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>-->
|
||||||
|
<!-- <div class="col-xs-12 col-sm-8">-->
|
||||||
|
<!-- <input id="c-create_time" data-rule="required" min="0" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{:date('Y-m-d H:i:s')}">-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- <div class="form-group">-->
|
||||||
|
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Update_time')}:</label>-->
|
||||||
|
<!-- <div class="col-xs-12 col-sm-8">-->
|
||||||
|
<!-- <input id="c-update_time" data-rule="required" min="0" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update_time]" type="text" value="{:date('Y-m-d H:i:s')}">-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<div class="form-group layer-footer">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
76
application/admin/view/manystore/shop_apply/edit.html
Normal file
76
application/admin/view/manystore/shop_apply/edit.html
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="mobile" data-format-item="{id} - {nickname} - {mobile}" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
|
||||||
|
<!-- <span style="color: red">-->
|
||||||
|
|
||||||
|
<!-- (没找到用户则点击按钮创建用户后重新下拉框选用户)-->
|
||||||
|
<!-- <a data-url="user/user/changeuser" href="javascript:;" class="btn btn-success btn-changeuser {:$auth->check('user/user/changeuser')?'':'hide'}" title="根据手机号生成用户" ><i class="fa fa-plus"></i> 根据手机号生成用户</a>-->
|
||||||
|
|
||||||
|
<!-- </span>-->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
|
||||||
|
<select id="c-type" data-rule="required" class="form-control selectpicker" name="row[type]">
|
||||||
|
{foreach name="typeList" item="vo"}
|
||||||
|
<option value="{$key}" {in name="key" value="$row.type"}selected{/in}>{$vo}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Realname')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-realname" data-rule="required" class="form-control" name="row[realname]" type="text" value="{$row.realname|htmlentities}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Mobile')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-mobile" data-rule="required" class="form-control" name="row[mobile]" type="text" value="{$row.mobile|htmlentities}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Address')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-address" class="form-control" name="row[address]" type="text" value="{$row.address|htmlentities}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="form-group">-->
|
||||||
|
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Shop_id')}:</label>-->
|
||||||
|
<!-- <div class="col-xs-12 col-sm-8">-->
|
||||||
|
<!-- <input id="c-shop_id" data-rule="required" data-source="manystore/shop/index" class="form-control selectpage" name="row[shop_id]" type="text" value="{$row.shop_id|htmlentities}">-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- <div class="form-group">-->
|
||||||
|
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>-->
|
||||||
|
<!-- <div class="col-xs-12 col-sm-8">-->
|
||||||
|
<!-- <input id="c-create_time" data-rule="required" min="0" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{:$row.create_time?datetime($row.create_time):''}">-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- <div class="form-group">-->
|
||||||
|
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Update_time')}:</label>-->
|
||||||
|
<!-- <div class="col-xs-12 col-sm-8">-->
|
||||||
|
<!-- <input id="c-update_time" data-rule="required" min="0" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update_time]" type="text" value="{:$row.update_time?datetime($row.update_time):''}">-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<div class="form-group layer-footer">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
29
application/admin/view/manystore/shop_apply/index.html
Normal file
29
application/admin/view/manystore/shop_apply/index.html
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<div class="panel panel-default panel-intro">
|
||||||
|
{:build_heading()}
|
||||||
|
|
||||||
|
<div class="panel-body">
|
||||||
|
<div id="myTabContent" class="tab-content">
|
||||||
|
<div class="tab-pane fade active in" id="one">
|
||||||
|
<div class="widget-body no-padding">
|
||||||
|
<div id="toolbar" class="toolbar">
|
||||||
|
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
|
||||||
|
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('manystore/shop_apply/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
|
||||||
|
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('manystore/shop_apply/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||||
|
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('manystore/shop_apply/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||||
|
data-operate-edit="{:$auth->check('manystore/shop_apply/edit')}"
|
||||||
|
data-operate-del="{:$auth->check('manystore/shop_apply/del')}"
|
||||||
|
width="100%">
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -3,6 +3,7 @@
|
|||||||
namespace app\api\controller\school;
|
namespace app\api\controller\school;
|
||||||
|
|
||||||
use app\common\model\dyqc\ManystoreShop;
|
use app\common\model\dyqc\ManystoreShop;
|
||||||
|
use app\common\model\manystore\ShopApply;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机构接口
|
* 机构接口
|
||||||
@ -61,8 +62,8 @@ class Shop extends Base
|
|||||||
|
|
||||||
|
|
||||||
/** 机构申请
|
/** 机构申请
|
||||||
* @ApiTitle( 机构申请)
|
* @ApiTitle( 机构申请(废弃))
|
||||||
* @ApiSummary(机构申请)
|
* @ApiSummary(机构申请(废弃))
|
||||||
* @ApiRoute(/api/school/shop/shopapply)
|
* @ApiRoute(/api/school/shop/shopapply)
|
||||||
* @ApiMethod(POST)
|
* @ApiMethod(POST)
|
||||||
* @ApiParams(name = "name", type = "string",required=true,description = "机构名称")
|
* @ApiParams(name = "name", type = "string",required=true,description = "机构名称")
|
||||||
@ -161,8 +162,8 @@ class Shop extends Base
|
|||||||
|
|
||||||
|
|
||||||
/** 个人申请
|
/** 个人申请
|
||||||
* @ApiTitle( 个人申请)
|
* @ApiTitle( 个人申请(废弃))
|
||||||
* @ApiSummary(个人申请)
|
* @ApiSummary(个人申请(废弃))
|
||||||
* @ApiRoute(/api/school/shop/userapply)
|
* @ApiRoute(/api/school/shop/userapply)
|
||||||
* @ApiMethod(POST)
|
* @ApiMethod(POST)
|
||||||
* @ApiParams(name = "name", type = "string",required=true,description = "姓名")
|
* @ApiParams(name = "name", type = "string",required=true,description = "姓名")
|
||||||
@ -442,4 +443,47 @@ class Shop extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** 机构申请新版接口
|
||||||
|
* @ApiTitle( 机构申请新版接口)
|
||||||
|
* @ApiSummary(机构申请新版接口)
|
||||||
|
* @ApiRoute(/api/school/shop/apply)
|
||||||
|
* @ApiMethod(POST)
|
||||||
|
* @ApiParams(name = "type", type = "string",required=true,description = "类型:1=个人,2=机构")
|
||||||
|
* @ApiParams(name = "name", type = "string",required=true,description = "机构名称(机构入驻才需要)")
|
||||||
|
* @ApiParams(name = "realname", type = "string",required=true,description = "联系人姓名")
|
||||||
|
* @ApiParams(name = "mobile", type = "string",required=true,description = "联系电话")
|
||||||
|
* @ApiParams(name = "address", type = "string",required=true,description = "地址")
|
||||||
|
* @ApiReturn({
|
||||||
|
*
|
||||||
|
*})
|
||||||
|
*/
|
||||||
|
public function apply(){
|
||||||
|
$params=[];
|
||||||
|
$params["name"] = $this->request->post('name/s','');
|
||||||
|
$params["realname"] = $this->request->post('realname/s','');
|
||||||
|
$params["mobile"] = $this->request->post('mobile/s','');
|
||||||
|
$params["address"] = $this->request->post('address/s','');
|
||||||
|
$params["type"] = $this->request->post('type/s','');
|
||||||
|
|
||||||
|
// if(empty($id)){
|
||||||
|
// $this->error(__('缺少必要参数'));
|
||||||
|
// }
|
||||||
|
$type = $params["type"];
|
||||||
|
$user_id = 0;
|
||||||
|
$user = $this->auth->getUser();//登录用户
|
||||||
|
if($user)$user_id = $user['id'];
|
||||||
|
$params["user_id"] = $user_id;
|
||||||
|
try {
|
||||||
|
$res = (new ShopApply())->apply($type,$user_id,$params,true,true);
|
||||||
|
} catch (\Exception $e){
|
||||||
|
// Log::log($e->getMessage());
|
||||||
|
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
|
||||||
|
}
|
||||||
|
$this->success('获取成功', ['detail' => $res]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -208,7 +208,7 @@ class Backend extends Controller
|
|||||||
$q_fields = [];
|
$q_fields = [];
|
||||||
|
|
||||||
foreach ($get as $kay=>$getField) {
|
foreach ($get as $kay=>$getField) {
|
||||||
if (in_array($kay, $fieldLists)) {
|
if (in_array($kay, $fieldLists) || in_array($kay, $this->qFields)) {
|
||||||
$q_fields[$kay] = $getField;
|
$q_fields[$kay] = $getField;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ class ManystoreBase extends Controller
|
|||||||
$q_fields = [];
|
$q_fields = [];
|
||||||
|
|
||||||
foreach ($get as $kay=>$getField) {
|
foreach ($get as $kay=>$getField) {
|
||||||
if (in_array($kay, $fieldLists)) {
|
if (in_array($kay, $fieldLists) || in_array($kay, $this->qFields)) {
|
||||||
$q_fields[$kay] = $getField;
|
$q_fields[$kay] = $getField;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ namespace app\common\model\dyqc;
|
|||||||
use app\admin\model\Admin;
|
use app\admin\model\Admin;
|
||||||
use app\common\library\Virtual;
|
use app\common\library\Virtual;
|
||||||
use app\common\model\BaseModel;
|
use app\common\model\BaseModel;
|
||||||
|
use app\common\model\manystore\ShopApply;
|
||||||
use app\common\model\school\Area;
|
use app\common\model\school\Area;
|
||||||
use app\common\model\school\classes\activity\Activity;
|
use app\common\model\school\classes\activity\Activity;
|
||||||
use app\common\model\school\classes\ClassesLib;
|
use app\common\model\school\classes\ClassesLib;
|
||||||
@ -894,7 +895,7 @@ public static function getAuthInfo($user_id){
|
|||||||
|
|
||||||
$verification = true; //核销权限
|
$verification = true; //核销权限
|
||||||
$verification_shop_id = 0; //可核销机构
|
$verification_shop_id = 0; //可核销机构
|
||||||
|
$join_number = self::getJoinNumber();
|
||||||
try{
|
try{
|
||||||
$verification_shop_id = ClassesLib::checkOptionAuth(0,$user_id,"user");
|
$verification_shop_id = ClassesLib::checkOptionAuth(0,$user_id,"user");
|
||||||
}catch (\Exception $e){
|
}catch (\Exception $e){
|
||||||
@ -907,7 +908,7 @@ public static function getAuthInfo($user_id){
|
|||||||
if(!$verification_classes_lib_ids && !$verification_shop_id && !$verification_classes_activity_ids){
|
if(!$verification_classes_lib_ids && !$verification_shop_id && !$verification_classes_activity_ids){
|
||||||
$verification = false;
|
$verification = false;
|
||||||
}
|
}
|
||||||
$verification_auth = compact("verification","verification_shop_id","verification_classes_lib_ids","verification_classes_activity_ids");
|
$verification_auth = compact("join_number","verification","verification_shop_id","verification_classes_lib_ids","verification_classes_activity_ids");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -926,14 +927,14 @@ public static function getAuthInfo($user_id){
|
|||||||
"logo"
|
"logo"
|
||||||
];
|
];
|
||||||
$apply_info = null;
|
$apply_info = null;
|
||||||
if(!$user_id)return compact("verification_auth","check_full_msg","check_full","check_field",'auth_status','shop_id','reason','apply_info',"type");
|
if(!$user_id)return compact("join_number","verification_auth","check_full_msg","check_full","check_field",'auth_status','shop_id','reason','apply_info',"type");
|
||||||
|
|
||||||
//得到申请单
|
//得到申请单
|
||||||
$apply_info = self::where("user_id",$user_id)->where("status","1")->find();
|
$apply_info = self::where("user_id",$user_id)->where("status","1")->find();
|
||||||
if(!$apply_info)$apply_info = self::where("user_id",$user_id)->find();
|
if(!$apply_info)$apply_info = self::where("user_id",$user_id)->find();
|
||||||
//不存在说明未申请,直接返回
|
//不存在说明未申请,直接返回
|
||||||
if(!$apply_info){
|
if(!$apply_info){
|
||||||
return compact("verification_auth","check_full_msg","check_full","check_field",'auth_status','shop_id','reason','apply_info',"type");
|
return compact("join_number","verification_auth","check_full_msg","check_full","check_field",'auth_status','shop_id','reason','apply_info',"type");
|
||||||
}
|
}
|
||||||
$type = $apply_info['type'];
|
$type = $apply_info['type'];
|
||||||
//从申请单取到申请状态
|
//从申请单取到申请状态
|
||||||
@ -952,7 +953,17 @@ public static function getAuthInfo($user_id){
|
|||||||
$check_full_msg = $self->checkFullMsg($shop_id);
|
$check_full_msg = $self->checkFullMsg($shop_id);
|
||||||
$check_full = $self->checkFull($shop_id);
|
$check_full = $self->checkFull($shop_id);
|
||||||
|
|
||||||
return compact("verification_auth","check_full_msg","check_full","check_field",'auth_status','shop_id','reason','apply_info',"type");
|
|
||||||
|
return compact("join_number","verification_auth","check_full_msg","check_full","check_field",'auth_status','shop_id','reason','apply_info',"type");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function getJoinNumber($real=false)
|
||||||
|
{
|
||||||
|
$number =self::count();
|
||||||
|
if($real) return $number;
|
||||||
|
return $number + (int) config('site.shop_base_apply_num');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1085,6 +1096,16 @@ public static function getAuthInfo($user_id){
|
|||||||
|
|
||||||
$manystore = Manystore::where("shop_id" ,$shop_id)->find();
|
$manystore = Manystore::where("shop_id" ,$shop_id)->find();
|
||||||
if($user && $manystore){
|
if($user && $manystore){
|
||||||
|
//更新申请表单状态
|
||||||
|
$shopApply = ShopApply::where("id",$manystore["shop_apply_id"])->find();
|
||||||
|
if($shopApply){
|
||||||
|
$shopApply->shop_id = $shop_id;
|
||||||
|
$shopApply->store_id = $manystore["id"];
|
||||||
|
$shopApply->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//授权认证成功
|
//授权认证成功
|
||||||
$result = \app\common\model\manystore\UserAuth::auth(0,$shop["id"],$shop["user_id"],"1",'admin',0);
|
$result = \app\common\model\manystore\UserAuth::auth(0,$shop["id"],$shop["user_id"],"1",'admin',0);
|
||||||
//删除用户所有老师和核销员
|
//删除用户所有老师和核销员
|
||||||
|
174
application/common/model/manystore/ShopApply.php
Normal file
174
application/common/model/manystore/ShopApply.php
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\model\manystore;
|
||||||
|
|
||||||
|
use app\common\model\BaseModel;
|
||||||
|
use app\common\model\dyqc\ManystoreShop;
|
||||||
|
use app\common\model\school\classes\Teacher;
|
||||||
|
use app\common\model\school\classes\Verification;
|
||||||
|
use app\common\model\User;
|
||||||
|
use think\Model;
|
||||||
|
|
||||||
|
|
||||||
|
class ShopApply extends BaseModel
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 表名
|
||||||
|
protected $name = 'manystore_shop_apply';
|
||||||
|
|
||||||
|
// 自动写入时间戳字段
|
||||||
|
protected $autoWriteTimestamp = false;
|
||||||
|
|
||||||
|
// 定义时间戳字段名
|
||||||
|
protected $createTime = "create_time";
|
||||||
|
protected $updateTime = "update_time";
|
||||||
|
protected $deleteTime = false;
|
||||||
|
|
||||||
|
// 追加属性
|
||||||
|
protected $append = [
|
||||||
|
'type_text',
|
||||||
|
'create_time_text',
|
||||||
|
'update_time_text'
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function getTypeList()
|
||||||
|
{
|
||||||
|
return ['1' => __('Type 1'), '2' => __('Type 2')];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getTypeTextAttr($value, $data)
|
||||||
|
{
|
||||||
|
$value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
|
||||||
|
$list = $this->getTypeList();
|
||||||
|
return isset($list[$value]) ? $list[$value] : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getCreateTimeTextAttr($value, $data)
|
||||||
|
{
|
||||||
|
$value = $value ? $value : (isset($data['create_time']) ? $data['create_time'] : '');
|
||||||
|
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getUpdateTimeTextAttr($value, $data)
|
||||||
|
{
|
||||||
|
$value = $value ? $value : (isset($data['update_time']) ? $data['update_time'] : '');
|
||||||
|
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function setCreateTimeAttr($value)
|
||||||
|
{
|
||||||
|
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function setUpdateTimeAttr($value)
|
||||||
|
{
|
||||||
|
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo('app\common\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function shop()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Shop::class, 'shop_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function apply($type,$user_id=0,$params,$check=false,$trans=false){
|
||||||
|
|
||||||
|
if(!in_array($type,['1','2'])) throw new \Exception('类型参数错误');
|
||||||
|
|
||||||
|
if($check){
|
||||||
|
$user = User::get($user_id ?: ($params["user_id"] ?? 0));
|
||||||
|
if(!$user)throw new \Exception("用户不存在");
|
||||||
|
//已经是机构
|
||||||
|
$shop = ManystoreShop::where( 'user_id',$user_id)->find();
|
||||||
|
if($shop){
|
||||||
|
throw new \Exception("已是机构,请勿重复申请");
|
||||||
|
}else{
|
||||||
|
//申请认证的时候不能是老师或其他机构的核销员
|
||||||
|
$teacher = Teacher::where("user_id" ,$user_id)->find();
|
||||||
|
if($teacher) throw new \Exception("您已经是老师,不能申请认证!");
|
||||||
|
|
||||||
|
$verification = Verification::where("user_id" ,$user_id)->find();
|
||||||
|
if($verification) throw new \Exception("您已经是机构核销员,不能申请认证!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
switch ($type) {
|
||||||
|
case '1': //个人
|
||||||
|
$rule = [
|
||||||
|
'realname' => 'require',
|
||||||
|
'user_id' => 'require',
|
||||||
|
'mobile' => 'require',
|
||||||
|
'address' => 'require',
|
||||||
|
];
|
||||||
|
$rule_msg = [
|
||||||
|
'user_id.require' => '请指定提交用户',
|
||||||
|
// 'name.require' => '机构名称必须填写',
|
||||||
|
'realname.require' => '联系人必须填写',
|
||||||
|
'mobile.require' => '联系人电话必须是数字',
|
||||||
|
'address.require' => '联系地址必须填写',
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case '2': //机构
|
||||||
|
|
||||||
|
$rule = [
|
||||||
|
'name' => 'require',
|
||||||
|
'realname' => 'require',
|
||||||
|
'mobile' => 'require',
|
||||||
|
'address' => 'require',
|
||||||
|
'user_id' => 'require',
|
||||||
|
];
|
||||||
|
|
||||||
|
$rule_msg = [
|
||||||
|
'user_id.require' => '请指定提交用户',
|
||||||
|
'name.require' => '机构名称必须填写',
|
||||||
|
'realname.require' => '联系人必须填写',
|
||||||
|
'mobile.require' => '联系人电话必须是数字',
|
||||||
|
'address.require' => '联系地址必须填写',
|
||||||
|
];
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
self::check($params,$rule,$rule_msg);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//判断逻辑
|
||||||
|
if($trans){
|
||||||
|
self::beginTrans();
|
||||||
|
}
|
||||||
|
// $res = false;
|
||||||
|
try{
|
||||||
|
$res = self::create($params);
|
||||||
|
|
||||||
|
if($trans){
|
||||||
|
self::commitTrans();
|
||||||
|
}
|
||||||
|
}catch (\Exception $e){
|
||||||
|
if($trans){
|
||||||
|
self::rollbackTrans();
|
||||||
|
}
|
||||||
|
throw new \Exception($e->getMessage().$e->getFile().$e->getLine());
|
||||||
|
}
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
}
|
@ -18,11 +18,11 @@ return [
|
|||||||
// 服务器地址
|
// 服务器地址
|
||||||
'hostname' => Env::get('database.hostname', '127.0.0.1'),
|
'hostname' => Env::get('database.hostname', '127.0.0.1'),
|
||||||
// 数据库名
|
// 数据库名
|
||||||
'database' => Env::get('database.database', 'duoyangqingchunyexiao'),
|
'database' => Env::get('database.database', 'duoyangnew'),
|
||||||
// 用户名
|
// 用户名
|
||||||
'username' => Env::get('database.username', 'duoyangqingchun'),
|
'username' => Env::get('database.username', 'duoyangnew'),
|
||||||
// 密码
|
// 密码
|
||||||
'password' => Env::get('database.password', 'C8YrFHBDwjaxjYbF'),
|
'password' => Env::get('database.password', 'hXJ4FfJhXYsBcXte'),
|
||||||
// 端口
|
// 端口
|
||||||
'hostport' => Env::get('database.hostport', ''),
|
'hostport' => Env::get('database.hostport', ''),
|
||||||
// 连接dsn
|
// 连接dsn
|
||||||
|
127
public/assets/js/backend/manystore/shop_apply.js
Normal file
127
public/assets/js/backend/manystore/shop_apply.js
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||||
|
|
||||||
|
var Controller = {
|
||||||
|
index: function () {
|
||||||
|
// 初始化表格参数配置
|
||||||
|
Table.api.init({
|
||||||
|
extend: {
|
||||||
|
index_url: 'manystore/shop_apply/index' + location.search,
|
||||||
|
add_url: 'manystore/shop_apply/add',
|
||||||
|
edit_url: 'manystore/shop_apply/edit',
|
||||||
|
del_url: 'manystore/shop_apply/del',
|
||||||
|
multi_url: 'manystore/shop_apply/multi',
|
||||||
|
generate_url: 'manystore/shop_apply/generate',//生成机构
|
||||||
|
import_url: 'manystore/shop_apply/import',
|
||||||
|
table: 'manystore_shop_apply',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var table = $("#table");
|
||||||
|
|
||||||
|
// 初始化表格
|
||||||
|
table.bootstrapTable({
|
||||||
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||||
|
pk: 'id',
|
||||||
|
sortName: 'id',
|
||||||
|
fixedColumns: true,
|
||||||
|
fixedRightNumber: 1,
|
||||||
|
columns: [
|
||||||
|
[
|
||||||
|
{checkbox: true},
|
||||||
|
{field: 'id', title: __('Id')},
|
||||||
|
{field: 'user_id', title: __('User_id')},
|
||||||
|
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
|
||||||
|
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
||||||
|
{field: 'realname', title: __('Realname'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||||
|
{field: 'mobile', title: __('Mobile'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||||
|
{field: 'address', title: __('Address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||||
|
{field: 'shop_id', title: __('Shop_id')},
|
||||||
|
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||||
|
{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||||
|
{field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
|
||||||
|
{field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
|
||||||
|
{field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||||
|
{field: 'shop.name', title: __('Shop.name'), operate: 'LIKE'},
|
||||||
|
{field: 'shop.logo', title: __('Shop.logo'), operate: 'LIKE'},
|
||||||
|
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||||
|
|
||||||
|
{field: 'operate', title: __('Operate'), table: table , buttons: [
|
||||||
|
{
|
||||||
|
name: 'edit',
|
||||||
|
text: __('生成机构'),
|
||||||
|
title: __('生成机构'),
|
||||||
|
auth:"edit",
|
||||||
|
classname: 'btn btn-xs btn-danger btn-magic btn-dialog',
|
||||||
|
icon: 'fa fa-cube',
|
||||||
|
// dropdown : '更多',
|
||||||
|
url: generate_url,
|
||||||
|
callback: function (data) {
|
||||||
|
|
||||||
|
},
|
||||||
|
visible: function (row) {
|
||||||
|
return !row.shop_id;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'generate',
|
||||||
|
text: __('查看机构'),
|
||||||
|
title: __('查看机构'),
|
||||||
|
auth:"generate",
|
||||||
|
classname: 'btn btn-xs btn-danger btn-magic btn-dialog',
|
||||||
|
icon: 'fa fa-cubes',
|
||||||
|
// dropdown : '更多',
|
||||||
|
url: list_url,
|
||||||
|
callback: function (data) {
|
||||||
|
|
||||||
|
},
|
||||||
|
visible: function (row) {
|
||||||
|
return row.shop_id;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
], events: Table.api.events.operate, formatter: Table.api.formatter.operate},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
]
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
// 为表格绑定事件
|
||||||
|
Table.api.bindevent(table);
|
||||||
|
},
|
||||||
|
add: function () {
|
||||||
|
Controller.api.bindevent();
|
||||||
|
},
|
||||||
|
edit: function () {
|
||||||
|
Controller.api.bindevent();
|
||||||
|
},
|
||||||
|
api: {
|
||||||
|
bindevent: function () {
|
||||||
|
Form.api.bindevent($("form[role=form]"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var generate_url = function (row,dom) {
|
||||||
|
|
||||||
|
return 'manystore/index/add?user_id='+row.user_id
|
||||||
|
+ '&type='+row.type
|
||||||
|
+ '&name=' + (row.name || row.realname)
|
||||||
|
+ '&tel='+row.mobile
|
||||||
|
+ '&shop_apply_id='+row.id
|
||||||
|
+ '&address_detail='+row.address + '&legal_entity='+row.realname;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var list_url = function (row,dom) {
|
||||||
|
return 'manystore/index/index?id='+row.store_id;
|
||||||
|
};
|
||||||
|
|
||||||
|
return Controller;
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user