正在显示
31 个修改的文件
包含
1029 行增加
和
39 行删除
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\deposit; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 板币充值配置管理 | ||
9 | + * | ||
10 | + * @icon fa fa-circle-o | ||
11 | + */ | ||
12 | +class Deposit extends Backend | ||
13 | +{ | ||
14 | + | ||
15 | + /** | ||
16 | + * Deposit模型对象 | ||
17 | + * @var \app\admin\model\deposit\Deposit | ||
18 | + */ | ||
19 | + protected $model = null; | ||
20 | + | ||
21 | + public function _initialize() | ||
22 | + { | ||
23 | + parent::_initialize(); | ||
24 | + $this->model = new \app\admin\model\deposit\Deposit; | ||
25 | + | ||
26 | + } | ||
27 | + | ||
28 | + /** | ||
29 | + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 | ||
30 | + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 | ||
31 | + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 | ||
32 | + */ | ||
33 | + | ||
34 | + | ||
35 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\deposit; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 充值订单管理 | ||
9 | + * | ||
10 | + * @icon fa fa-circle-o | ||
11 | + */ | ||
12 | +class DepositOrder extends Backend | ||
13 | +{ | ||
14 | + | ||
15 | + /** | ||
16 | + * DepositOrder模型对象 | ||
17 | + * @var \app\admin\model\deposit\DepositOrder | ||
18 | + */ | ||
19 | + protected $model = null; | ||
20 | + | ||
21 | + public function _initialize() | ||
22 | + { | ||
23 | + parent::_initialize(); | ||
24 | + $this->model = new \app\admin\model\deposit\DepositOrder; | ||
25 | + $this->view->assign("statusList", $this->model->getStatusList()); | ||
26 | + } | ||
27 | + | ||
28 | + /** | ||
29 | + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 | ||
30 | + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 | ||
31 | + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 | ||
32 | + */ | ||
33 | + | ||
34 | + | ||
35 | + /** | ||
36 | + * 查看 | ||
37 | + */ | ||
38 | + public function index() | ||
39 | + { | ||
40 | + //当前是否为关联查询 | ||
41 | + $this->relationSearch = true; | ||
42 | + //设置过滤方法 | ||
43 | + $this->request->filter(['strip_tags', 'trim']); | ||
44 | + if ($this->request->isAjax()) | ||
45 | + { | ||
46 | + //如果发送的来源是Selectpage,则转发到Selectpage | ||
47 | + if ($this->request->request('keyField')) | ||
48 | + { | ||
49 | + return $this->selectpage(); | ||
50 | + } | ||
51 | + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | ||
52 | + $total = $this->model | ||
53 | + ->with(['user']) | ||
54 | + ->where($where) | ||
55 | + ->order($sort, $order) | ||
56 | + ->count(); | ||
57 | + | ||
58 | + $list = $this->model | ||
59 | + ->with(['user']) | ||
60 | + ->where($where) | ||
61 | + ->order($sort, $order) | ||
62 | + ->limit($offset, $limit) | ||
63 | + ->select(); | ||
64 | + | ||
65 | + foreach ($list as $row) { | ||
66 | + | ||
67 | + $row->getRelation('user')->visible(['nickname']); | ||
68 | + } | ||
69 | + $list = collection($list)->toArray(); | ||
70 | + $result = array("total" => $total, "rows" => $list); | ||
71 | + | ||
72 | + return json($result); | ||
73 | + } | ||
74 | + return $this->view->fetch(); | ||
75 | + } | ||
76 | +} |
@@ -104,7 +104,7 @@ class Store extends Backend | @@ -104,7 +104,7 @@ class Store extends Backend | ||
104 | $params = $this->preExcludeFields($params); | 104 | $params = $this->preExcludeFields($params); |
105 | $admin_model = new Admin(); | 105 | $admin_model = new Admin(); |
106 | $auth_group_model = new AuthGroupAccess(); | 106 | $auth_group_model = new AuthGroupAccess(); |
107 | - if($params['status'] == 2) { | 107 | + if($params['status'] == 3) { |
108 | $salt = Random::alnum(); | 108 | $salt = Random::alnum(); |
109 | $password = md5(md5($params['password']) . $salt); | 109 | $password = md5(md5($params['password']) . $salt); |
110 | $admin_data = [ | 110 | $admin_data = [ |
@@ -123,13 +123,13 @@ class Store extends Backend | @@ -123,13 +123,13 @@ class Store extends Backend | ||
123 | try { | 123 | try { |
124 | $result = $row->allowField(true)->save($params); | 124 | $result = $row->allowField(true)->save($params); |
125 | // 判断审核状态 | 125 | // 判断审核状态 |
126 | - if($params['status'] == 2) { | 126 | + if($params['status'] == 3) { |
127 | // 审核通过,新增商家管理员 | 127 | // 审核通过,新增商家管理员 |
128 | $result_admin = $admin_model->isUpdate(false)->save($admin_data); | 128 | $result_admin = $admin_model->isUpdate(false)->save($admin_data); |
129 | $auth_group_data['uid'] = $admin_model->id; | 129 | $auth_group_data['uid'] = $admin_model->id; |
130 | $result_auth_group = $auth_group_model->isUpdate(false)->save($auth_group_data); | 130 | $result_auth_group = $auth_group_model->isUpdate(false)->save($auth_group_data); |
131 | } | 131 | } |
132 | - if($params['status'] == 3) { | 132 | + if($params['status'] == 4) { |
133 | // 审核不通过,执行退款操作 | 133 | // 审核不通过,执行退款操作 |
134 | $refund = [ | 134 | $refund = [ |
135 | 'order_id' => $row->id, | 135 | 'order_id' => $row->id, |
1 | +<?php | ||
2 | + | ||
3 | +return [ | ||
4 | + 'Order_sn' => '订单号', | ||
5 | + 'User_id' => '用户id', | ||
6 | + 'Deposit_id' => '充值id', | ||
7 | + 'Score' => '板币数量', | ||
8 | + 'Money' => '支付金额', | ||
9 | + 'Status' => '状态', | ||
10 | + 'Status 1' => '待付款', | ||
11 | + 'Status 2' => '已支付', | ||
12 | + 'Pay_time' => '支付时间', | ||
13 | + 'Transaction_id' => '微信支付ID', | ||
14 | + 'Createtime' => '生成时间', | ||
15 | + 'Updatetime' => '更新时间', | ||
16 | + 'User.nickname' => '昵称' | ||
17 | +]; |
@@ -11,9 +11,10 @@ return [ | @@ -11,9 +11,10 @@ return [ | ||
11 | 'Mobile' => '联系人手机号', | 11 | 'Mobile' => '联系人手机号', |
12 | 'License' => '营业执照', | 12 | 'License' => '营业执照', |
13 | 'Status' => '状态', | 13 | 'Status' => '状态', |
14 | - 'Status 1' => '待审核', | ||
15 | - 'Status 2' => '审核通过', | ||
16 | - 'Status 3' => '审核驳回', | 14 | + 'Status 1' => '待支付', |
15 | + 'Status 2' => '待审核', | ||
16 | + 'Status 3' => '审核通过', | ||
17 | + 'Status 4' => '审核驳回', | ||
17 | 'Pay_time' => '支付时间', | 18 | 'Pay_time' => '支付时间', |
18 | 'Transaction_id' => '微信支付ID', | 19 | 'Transaction_id' => '微信支付ID', |
19 | 'Store_icon' => '店铺图标', | 20 | 'Store_icon' => '店铺图标', |
application/admin/model/deposit/Deposit.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\model\deposit; | ||
4 | + | ||
5 | +use think\Model; | ||
6 | + | ||
7 | + | ||
8 | +class Deposit extends Model | ||
9 | +{ | ||
10 | + | ||
11 | + | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + // 表名 | ||
16 | + protected $name = 'deposit'; | ||
17 | + | ||
18 | + // 自动写入时间戳字段 | ||
19 | + protected $autoWriteTimestamp = 'int'; | ||
20 | + | ||
21 | + // 定义时间戳字段名 | ||
22 | + protected $createTime = 'createtime'; | ||
23 | + protected $updateTime = 'updatetime'; | ||
24 | + protected $deleteTime = false; | ||
25 | + | ||
26 | + // 追加属性 | ||
27 | + protected $append = [ | ||
28 | + | ||
29 | + ]; | ||
30 | + | ||
31 | + | ||
32 | + protected static function init() | ||
33 | + { | ||
34 | + self::afterInsert(function ($row) { | ||
35 | + $pk = $row->getPk(); | ||
36 | + $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]); | ||
37 | + }); | ||
38 | + } | ||
39 | + | ||
40 | + | ||
41 | + | ||
42 | + | ||
43 | + | ||
44 | + | ||
45 | + | ||
46 | + | ||
47 | + | ||
48 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\model\deposit; | ||
4 | + | ||
5 | +use think\Model; | ||
6 | + | ||
7 | + | ||
8 | +class DepositOrder extends Model | ||
9 | +{ | ||
10 | + | ||
11 | + | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + // 表名 | ||
16 | + protected $name = 'deposit_order'; | ||
17 | + | ||
18 | + // 自动写入时间戳字段 | ||
19 | + protected $autoWriteTimestamp = 'int'; | ||
20 | + | ||
21 | + // 定义时间戳字段名 | ||
22 | + protected $createTime = 'createtime'; | ||
23 | + protected $updateTime = 'updatetime'; | ||
24 | + protected $deleteTime = false; | ||
25 | + | ||
26 | + // 追加属性 | ||
27 | + protected $append = [ | ||
28 | + 'status_text', | ||
29 | + 'pay_time_text' | ||
30 | + ]; | ||
31 | + | ||
32 | + | ||
33 | + | ||
34 | + public function getStatusList() | ||
35 | + { | ||
36 | + return ['1' => __('Status 1'), '2' => __('Status 2')]; | ||
37 | + } | ||
38 | + | ||
39 | + | ||
40 | + public function getStatusTextAttr($value, $data) | ||
41 | + { | ||
42 | + $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); | ||
43 | + $list = $this->getStatusList(); | ||
44 | + return isset($list[$value]) ? $list[$value] : ''; | ||
45 | + } | ||
46 | + | ||
47 | + | ||
48 | + public function getPayTimeTextAttr($value, $data) | ||
49 | + { | ||
50 | + $value = $value ? $value : (isset($data['pay_time']) ? $data['pay_time'] : ''); | ||
51 | + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; | ||
52 | + } | ||
53 | + | ||
54 | + protected function setPayTimeAttr($value) | ||
55 | + { | ||
56 | + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); | ||
57 | + } | ||
58 | + | ||
59 | + | ||
60 | + public function user() | ||
61 | + { | ||
62 | + return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); | ||
63 | + } | ||
64 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\validate\deposit; | ||
4 | + | ||
5 | +use think\Validate; | ||
6 | + | ||
7 | +class Deposit extends Validate | ||
8 | +{ | ||
9 | + /** | ||
10 | + * 验证规则 | ||
11 | + */ | ||
12 | + protected $rule = [ | ||
13 | + ]; | ||
14 | + /** | ||
15 | + * 提示消息 | ||
16 | + */ | ||
17 | + protected $message = [ | ||
18 | + ]; | ||
19 | + /** | ||
20 | + * 验证场景 | ||
21 | + */ | ||
22 | + protected $scene = [ | ||
23 | + 'add' => [], | ||
24 | + 'edit' => [], | ||
25 | + ]; | ||
26 | + | ||
27 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\validate\deposit; | ||
4 | + | ||
5 | +use think\Validate; | ||
6 | + | ||
7 | +class DepositOrder extends Validate | ||
8 | +{ | ||
9 | + /** | ||
10 | + * 验证规则 | ||
11 | + */ | ||
12 | + protected $rule = [ | ||
13 | + ]; | ||
14 | + /** | ||
15 | + * 提示消息 | ||
16 | + */ | ||
17 | + protected $message = [ | ||
18 | + ]; | ||
19 | + /** | ||
20 | + * 验证场景 | ||
21 | + */ | ||
22 | + protected $scene = [ | ||
23 | + 'add' => [], | ||
24 | + 'edit' => [], | ||
25 | + ]; | ||
26 | + | ||
27 | +} |
1 | +<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + | ||
3 | + <div class="form-group"> | ||
4 | + <label class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <input id="c-money" data-rule="required" class="form-control" step="0.01" name="row[money]" type="number" value="0.00"> | ||
7 | + </div> | ||
8 | + </div> | ||
9 | + <div class="form-group"> | ||
10 | + <label class="control-label col-xs-12 col-sm-2">{:__('Score')}:</label> | ||
11 | + <div class="col-xs-12 col-sm-8"> | ||
12 | + <input id="c-score" data-rule="required" class="form-control" name="row[score]" type="number" value="0"> | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + <div class="form-group"> | ||
16 | + <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label> | ||
17 | + <div class="col-xs-12 col-sm-8"> | ||
18 | + <input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="0"> | ||
19 | + </div> | ||
20 | + </div> | ||
21 | + <div class="form-group layer-footer"> | ||
22 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
23 | + <div class="col-xs-12 col-sm-8"> | ||
24 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
25 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
26 | + </div> | ||
27 | + </div> | ||
28 | +</form> |
1 | +<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + | ||
3 | + <div class="form-group"> | ||
4 | + <label class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <input id="c-money" data-rule="required" class="form-control" step="0.01" name="row[money]" type="number" value="{$row.money|htmlentities}"> | ||
7 | + </div> | ||
8 | + </div> | ||
9 | + <div class="form-group"> | ||
10 | + <label class="control-label col-xs-12 col-sm-2">{:__('Score')}:</label> | ||
11 | + <div class="col-xs-12 col-sm-8"> | ||
12 | + <input id="c-score" data-rule="required" class="form-control" name="row[score]" type="number" value="{$row.score|htmlentities}"> | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + <div class="form-group"> | ||
16 | + <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label> | ||
17 | + <div class="col-xs-12 col-sm-8"> | ||
18 | + <input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}"> | ||
19 | + </div> | ||
20 | + </div> | ||
21 | + <div class="form-group layer-footer"> | ||
22 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
23 | + <div class="col-xs-12 col-sm-8"> | ||
24 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
25 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
26 | + </div> | ||
27 | + </div> | ||
28 | +</form> |
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + {:build_heading()} | ||
3 | + | ||
4 | + <div class="panel-body"> | ||
5 | + <div id="myTabContent" class="tab-content"> | ||
6 | + <div class="tab-pane fade active in" id="one"> | ||
7 | + <div class="widget-body no-padding"> | ||
8 | + <div id="toolbar" class="toolbar"> | ||
9 | + <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a> | ||
10 | + <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('deposit/deposit/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a> | ||
11 | + <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('deposit/deposit/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a> | ||
12 | + <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('deposit/deposit/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a> | ||
13 | +<!-- <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('deposit/deposit/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>--> | ||
14 | + | ||
15 | +<!-- <div class="dropdown btn-group {:$auth->check('deposit/deposit/multi')?'':'hide'}">--> | ||
16 | +<!-- <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>--> | ||
17 | +<!-- <ul class="dropdown-menu text-left" role="menu">--> | ||
18 | +<!-- <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>--> | ||
19 | +<!-- <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>--> | ||
20 | +<!-- </ul>--> | ||
21 | +<!-- </div>--> | ||
22 | + | ||
23 | + | ||
24 | + </div> | ||
25 | + <table id="table" class="table table-striped table-bordered table-hover table-nowrap" | ||
26 | + data-operate-edit="{:$auth->check('deposit/deposit/edit')}" | ||
27 | + data-operate-del="{:$auth->check('deposit/deposit/del')}" | ||
28 | + width="100%"> | ||
29 | + </table> | ||
30 | + </div> | ||
31 | + </div> | ||
32 | + | ||
33 | + </div> | ||
34 | + </div> | ||
35 | +</div> |
1 | +<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + | ||
3 | + <div class="form-group"> | ||
4 | + <label class="control-label col-xs-12 col-sm-2">{:__('Order_sn')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <input id="c-order_sn" data-rule="required" class="form-control" name="row[order_sn]" type="text" value="''"> | ||
7 | + </div> | ||
8 | + </div> | ||
9 | + <div class="form-group"> | ||
10 | + <label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label> | ||
11 | + <div class="col-xs-12 col-sm-8"> | ||
12 | + <input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value=""> | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + <div class="form-group"> | ||
16 | + <label class="control-label col-xs-12 col-sm-2">{:__('Deposit_id')}:</label> | ||
17 | + <div class="col-xs-12 col-sm-8"> | ||
18 | + <input id="c-deposit_id" data-rule="required" data-source="deposit/index" class="form-control selectpage" name="row[deposit_id]" type="text" value=""> | ||
19 | + </div> | ||
20 | + </div> | ||
21 | + <div class="form-group"> | ||
22 | + <label class="control-label col-xs-12 col-sm-2">{:__('Score')}:</label> | ||
23 | + <div class="col-xs-12 col-sm-8"> | ||
24 | + <input id="c-score" data-rule="required" class="form-control" name="row[score]" type="number" value="0"> | ||
25 | + </div> | ||
26 | + </div> | ||
27 | + <div class="form-group"> | ||
28 | + <label class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label> | ||
29 | + <div class="col-xs-12 col-sm-8"> | ||
30 | + <input id="c-money" data-rule="required" class="form-control" step="0.01" name="row[money]" type="number" value="0.00"> | ||
31 | + </div> | ||
32 | + </div> | ||
33 | + <div class="form-group"> | ||
34 | + <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label> | ||
35 | + <div class="col-xs-12 col-sm-8"> | ||
36 | + | ||
37 | + <div class="radio"> | ||
38 | + {foreach name="statusList" item="vo"} | ||
39 | + <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="1"}checked{/in} /> {$vo}</label> | ||
40 | + {/foreach} | ||
41 | + </div> | ||
42 | + | ||
43 | + </div> | ||
44 | + </div> | ||
45 | + <div class="form-group"> | ||
46 | + <label class="control-label col-xs-12 col-sm-2">{:__('Pay_time')}:</label> | ||
47 | + <div class="col-xs-12 col-sm-8"> | ||
48 | + <input id="c-pay_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[pay_time]" type="text" value="{:date('Y-m-d H:i:s')}"> | ||
49 | + </div> | ||
50 | + </div> | ||
51 | + <div class="form-group"> | ||
52 | + <label class="control-label col-xs-12 col-sm-2">{:__('Transaction_id')}:</label> | ||
53 | + <div class="col-xs-12 col-sm-8"> | ||
54 | + <input id="c-transaction_id" data-rule="required" data-source="transaction/index" class="form-control selectpage" name="row[transaction_id]" type="text" value=""> | ||
55 | + </div> | ||
56 | + </div> | ||
57 | + <div class="form-group layer-footer"> | ||
58 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
59 | + <div class="col-xs-12 col-sm-8"> | ||
60 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
61 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
62 | + </div> | ||
63 | + </div> | ||
64 | +</form> |
1 | +<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + | ||
3 | + <div class="form-group"> | ||
4 | + <label class="control-label col-xs-12 col-sm-2">{:__('Order_sn')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <input id="c-order_sn" data-rule="required" class="form-control" name="row[order_sn]" type="text" value="{$row.order_sn|htmlentities}"> | ||
7 | + </div> | ||
8 | + </div> | ||
9 | + <div class="form-group"> | ||
10 | + <label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label> | ||
11 | + <div class="col-xs-12 col-sm-8"> | ||
12 | + <input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}"> | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + <div class="form-group"> | ||
16 | + <label class="control-label col-xs-12 col-sm-2">{:__('Deposit_id')}:</label> | ||
17 | + <div class="col-xs-12 col-sm-8"> | ||
18 | + <input id="c-deposit_id" data-rule="required" data-source="deposit/index" class="form-control selectpage" name="row[deposit_id]" type="text" value="{$row.deposit_id|htmlentities}"> | ||
19 | + </div> | ||
20 | + </div> | ||
21 | + <div class="form-group"> | ||
22 | + <label class="control-label col-xs-12 col-sm-2">{:__('Score')}:</label> | ||
23 | + <div class="col-xs-12 col-sm-8"> | ||
24 | + <input id="c-score" data-rule="required" class="form-control" name="row[score]" type="number" value="{$row.score|htmlentities}"> | ||
25 | + </div> | ||
26 | + </div> | ||
27 | + <div class="form-group"> | ||
28 | + <label class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label> | ||
29 | + <div class="col-xs-12 col-sm-8"> | ||
30 | + <input id="c-money" data-rule="required" class="form-control" step="0.01" name="row[money]" type="number" value="{$row.money|htmlentities}"> | ||
31 | + </div> | ||
32 | + </div> | ||
33 | + <div class="form-group"> | ||
34 | + <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label> | ||
35 | + <div class="col-xs-12 col-sm-8"> | ||
36 | + | ||
37 | + <div class="radio"> | ||
38 | + {foreach name="statusList" item="vo"} | ||
39 | + <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label> | ||
40 | + {/foreach} | ||
41 | + </div> | ||
42 | + | ||
43 | + </div> | ||
44 | + </div> | ||
45 | + <div class="form-group"> | ||
46 | + <label class="control-label col-xs-12 col-sm-2">{:__('Pay_time')}:</label> | ||
47 | + <div class="col-xs-12 col-sm-8"> | ||
48 | + <input id="c-pay_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[pay_time]" type="text" value="{:$row.pay_time?datetime($row.pay_time):''}"> | ||
49 | + </div> | ||
50 | + </div> | ||
51 | + <div class="form-group"> | ||
52 | + <label class="control-label col-xs-12 col-sm-2">{:__('Transaction_id')}:</label> | ||
53 | + <div class="col-xs-12 col-sm-8"> | ||
54 | + <input id="c-transaction_id" data-rule="required" data-source="transaction/index" class="form-control selectpage" name="row[transaction_id]" type="text" value="{$row.transaction_id|htmlentities}"> | ||
55 | + </div> | ||
56 | + </div> | ||
57 | + <div class="form-group layer-footer"> | ||
58 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
59 | + <div class="col-xs-12 col-sm-8"> | ||
60 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
61 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
62 | + </div> | ||
63 | + </div> | ||
64 | +</form> |
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + | ||
3 | + <div class="panel-heading"> | ||
4 | + {:build_heading(null,FALSE)} | ||
5 | + <ul class="nav nav-tabs" data-field="status"> | ||
6 | + <li class="active"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li> | ||
7 | + {foreach name="statusList" item="vo"} | ||
8 | + <li><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li> | ||
9 | + {/foreach} | ||
10 | + </ul> | ||
11 | + </div> | ||
12 | + | ||
13 | + | ||
14 | + <div class="panel-body"> | ||
15 | + <div id="myTabContent" class="tab-content"> | ||
16 | + <div class="tab-pane fade active in" id="one"> | ||
17 | + <div class="widget-body no-padding"> | ||
18 | + <div id="toolbar" class="toolbar"> | ||
19 | + <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a> | ||
20 | + <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('deposit/deposit_order/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a> | ||
21 | + <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('deposit/deposit_order/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a> | ||
22 | + <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('deposit/deposit_order/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a> | ||
23 | + <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('deposit/deposit_order/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a> | ||
24 | + | ||
25 | + <div class="dropdown btn-group {:$auth->check('deposit/deposit_order/multi')?'':'hide'}"> | ||
26 | + <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a> | ||
27 | + <ul class="dropdown-menu text-left" role="menu"> | ||
28 | + <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li> | ||
29 | + <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li> | ||
30 | + </ul> | ||
31 | + </div> | ||
32 | + | ||
33 | + | ||
34 | + </div> | ||
35 | + <table id="table" class="table table-striped table-bordered table-hover table-nowrap" | ||
36 | + data-operate-edit="{:$auth->check('deposit/deposit_order/edit')}" | ||
37 | + data-operate-del="{:$auth->check('deposit/deposit_order/del')}" | ||
38 | + width="100%"> | ||
39 | + </table> | ||
40 | + </div> | ||
41 | + </div> | ||
42 | + | ||
43 | + </div> | ||
44 | + </div> | ||
45 | +</div> |
application/api/behavior/user/User.php
0 → 100644
@@ -53,6 +53,34 @@ class Store extends Api | @@ -53,6 +53,34 @@ class Store extends Api | ||
53 | } | 53 | } |
54 | 54 | ||
55 | /** | 55 | /** |
56 | + * 入驻协议 | ||
57 | + * @ApiWeigh (90) | ||
58 | + * | ||
59 | + * @ApiTitle (入驻协议) | ||
60 | + * @ApiSummary (入驻协议) | ||
61 | + * @ApiMethod (POST) | ||
62 | + * @ApiRoute (/api/store/settled) | ||
63 | + * @ApiReturnParams (name="code", type="integer", required=true, sample="0") | ||
64 | + * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") | ||
65 | + * @ApiReturn ({ | ||
66 | + 'code':'1', | ||
67 | + 'msg':'返回成功', | ||
68 | + "data": { | ||
69 | + "settled": 入驻协议, | ||
70 | + } | ||
71 | + }) | ||
72 | + */ | ||
73 | + public function settled() | ||
74 | + { | ||
75 | + if($this->request->isPost()){ | ||
76 | + $return = [ | ||
77 | + 'settled' => config('site.settled') | ||
78 | + ]; | ||
79 | + $this->success('成功',$return); | ||
80 | + } | ||
81 | + } | ||
82 | + | ||
83 | + /** | ||
56 | * 行业列表 | 84 | * 行业列表 |
57 | * @ApiWeigh (80) | 85 | * @ApiWeigh (80) |
58 | * | 86 | * |
@@ -121,6 +149,22 @@ class Store extends Api | @@ -121,6 +149,22 @@ class Store extends Api | ||
121 | public function store_add() | 149 | public function store_add() |
122 | { | 150 | { |
123 | $param = (new StoreValidate())->goCheck('store_add'); | 151 | $param = (new StoreValidate())->goCheck('store_add'); |
152 | + $where_s = ['user_id'=>$this->user_id]; | ||
153 | + $where = [ | ||
154 | + 'where' => $where_s | ||
155 | + ]; | ||
156 | + $store = $this->store_model->findOrFail($where,false,'*','createtime'); | ||
157 | + if($store) { | ||
158 | + if($store['status'] == 1) { | ||
159 | + $param['id'] = $store['id']; | ||
160 | + } | ||
161 | + if($store['status'] == 2) { | ||
162 | + $this->error('商家申请仍在审核中'); | ||
163 | + } | ||
164 | + if($store['status'] == 3) { | ||
165 | + $this->error('商家申请已通过'); | ||
166 | + } | ||
167 | + } | ||
124 | $order_sn = $param['order_sn'] = get_order_sn(); | 168 | $order_sn = $param['order_sn'] = get_order_sn(); |
125 | $pay_data = []; | 169 | $pay_data = []; |
126 | // if($this->auth->end_time > time()) { | 170 | // if($this->auth->end_time > time()) { |
@@ -155,7 +199,11 @@ class Store extends Api | @@ -155,7 +199,11 @@ class Store extends Api | ||
155 | $result_invite = true; | 199 | $result_invite = true; |
156 | try{ | 200 | try{ |
157 | $param['user_id'] = $this->auth->id; | 201 | $param['user_id'] = $this->auth->id; |
158 | - $result = $this->store_model->add($param); | 202 | + if(!empty($param['id'])) { |
203 | + $result = $this->store_model->edit($param); | ||
204 | + } else { | ||
205 | + $result = $this->store_model->add($param); | ||
206 | + } | ||
159 | $id = $this->store_model->id; | 207 | $id = $this->store_model->id; |
160 | Db::commit(); | 208 | Db::commit(); |
161 | } catch (PDOException $e) { | 209 | } catch (PDOException $e) { |
@@ -270,7 +318,15 @@ class Store extends Api | @@ -270,7 +318,15 @@ class Store extends Api | ||
270 | * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") | 318 | * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") |
271 | * @ApiReturn ({ | 319 | * @ApiReturn ({ |
272 | 'code':'1', | 320 | 'code':'1', |
273 | - 'msg':'返回成功' | 321 | + 'msg':'返回成功', |
322 | + "data": { | ||
323 | + "id": 1, | ||
324 | + "store_name": "123", | ||
325 | + "image_arr": [ | ||
326 | + "http://cloud.caiyunpan.brotop.cn/assets/img/qrcode.png", | ||
327 | + "http://cloud.caiyunpan.brotop.cn/assets/img/qrcode.png" | ||
328 | + ] | ||
329 | + } | ||
274 | }) | 330 | }) |
275 | */ | 331 | */ |
276 | public function store() | 332 | public function store() |
@@ -458,7 +514,7 @@ class Store extends Api | @@ -458,7 +514,7 @@ class Store extends Api | ||
458 | 514 | ||
459 | /** | 515 | /** |
460 | * 留言消息 | 516 | * 留言消息 |
461 | - * @ApiWeigh (80) | 517 | + * @ApiWeigh (24) |
462 | * | 518 | * |
463 | * @ApiTitle (留言消息) | 519 | * @ApiTitle (留言消息) |
464 | * @ApiSummary (留言消息) | 520 | * @ApiSummary (留言消息) |
@@ -472,27 +528,27 @@ class Store extends Api | @@ -472,27 +528,27 @@ class Store extends Api | ||
472 | 'code':'1', | 528 | 'code':'1', |
473 | 'msg':'返回成功', | 529 | 'msg':'返回成功', |
474 | "data": { | 530 | "data": { |
475 | - "list": [ | ||
476 | - { | ||
477 | - "id": 1, | ||
478 | - "name": "行业名称", | ||
479 | - "weigh": 0, | ||
480 | - } | ||
481 | - ] | 531 | + "list": [ |
532 | + { | ||
533 | + "id": 1, | ||
534 | + "name": "行业名称", | ||
535 | + "weigh": 0, | ||
536 | + } | ||
537 | + ] | ||
482 | } | 538 | } |
483 | }) | 539 | }) |
484 | */ | 540 | */ |
485 | - public function store_list() | 541 | + public function comment_list() |
486 | { | 542 | { |
487 | if($this->request->isPost()){ | 543 | if($this->request->isPost()){ |
488 | - $param = (new StoreValidate())->goCheck('comment_reply'); | 544 | + $param = (new StoreValidate())->goCheck('common'); |
489 | $store = $this->get_store(); | 545 | $store = $this->get_store(); |
490 | $page = $param['page']; | 546 | $page = $param['page']; |
491 | $where = [ | 547 | $where = [ |
492 | 'where' => ['store_id'=>$store['id']], | 548 | 'where' => ['store_id'=>$store['id']], |
493 | 'with' => ['user_info'] | 549 | 'with' => ['user_info'] |
494 | ]; | 550 | ]; |
495 | - $order = ['number'=>'DESC','createtime'=>'DESC']; | 551 | + $order = ['createtime'=>'DESC']; |
496 | $model = new StoreComment(); | 552 | $model = new StoreComment(); |
497 | $comment = $model->pageSelect($page,$where,'*',$order,config('option.num')); | 553 | $comment = $model->pageSelect($page,$where,'*',$order,config('option.num')); |
498 | $list = $comment->items(); | 554 | $list = $comment->items(); |
@@ -506,11 +562,55 @@ class Store extends Api | @@ -506,11 +562,55 @@ class Store extends Api | ||
506 | } | 562 | } |
507 | 563 | ||
508 | /** | 564 | /** |
509 | - * 留言消息 | ||
510 | - * @ApiWeigh (50) | 565 | + * 留言消息详情 |
566 | + * @ApiWeigh (23) | ||
511 | * | 567 | * |
512 | - * @ApiTitle (留言消息) | ||
513 | - * @ApiSummary (留言消息) | 568 | + * @ApiTitle (留言消息详情) |
569 | + * @ApiSummary (留言消息详情) | ||
570 | + * @ApiMethod (POST) | ||
571 | + * @ApiRoute (/api/store/comment_detail) | ||
572 | + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") | ||
573 | + * @ApiParams (name="comment_id", type="integer", required=true, description="留言id") | ||
574 | + * @ApiReturnParams (name="code", type="integer", required=true, sample="0") | ||
575 | + * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") | ||
576 | + * @ApiReturn ({ | ||
577 | + 'code':'1', | ||
578 | + 'msg':'返回成功', | ||
579 | + "data": { | ||
580 | + "comment": [ | ||
581 | + { | ||
582 | + "id": 1, | ||
583 | + "name": "行业名称", | ||
584 | + "weigh": 0, | ||
585 | + } | ||
586 | + ] | ||
587 | + } | ||
588 | + }) | ||
589 | + */ | ||
590 | + public function comment_detail() | ||
591 | + { | ||
592 | + if($this->request->isPost()){ | ||
593 | + $param = (new StoreValidate())->goCheck('comment_detail'); | ||
594 | + $store = $this->get_store(); | ||
595 | + $where = [ | ||
596 | + 'where' => ['id'=>$param['comment_id']], | ||
597 | + 'with' => ['user_info'] | ||
598 | + ]; | ||
599 | + $model = new StoreComment(); | ||
600 | + $comment = $model->findOrFail($where,'*'); | ||
601 | + $return = [ | ||
602 | + 'comment' => $comment | ||
603 | + ]; | ||
604 | + $this->success('请求成功',$return); | ||
605 | + } | ||
606 | + } | ||
607 | + | ||
608 | + /** | ||
609 | + * 留言回复 | ||
610 | + * @ApiWeigh (22) | ||
611 | + * | ||
612 | + * @ApiTitle (留言回复) | ||
613 | + * @ApiSummary (留言回复) | ||
514 | * @ApiMethod (POST) | 614 | * @ApiMethod (POST) |
515 | * @ApiRoute (/api/store/comment_reply) | 615 | * @ApiRoute (/api/store/comment_reply) |
516 | * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") | 616 | * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") |
@@ -561,29 +661,26 @@ class Store extends Api | @@ -561,29 +661,26 @@ class Store extends Api | ||
561 | 'code':'1', | 661 | 'code':'1', |
562 | 'msg':'返回成功', | 662 | 'msg':'返回成功', |
563 | "data": { | 663 | "data": { |
564 | - "list": [ | ||
565 | - { | ||
566 | - "id": 1, | ||
567 | - "name": "行业名称", | ||
568 | - "weigh": 0, | ||
569 | - } | ||
570 | - ] | 664 | + "list": [ |
665 | + { | ||
666 | + "id": 1, | ||
667 | + "money": "充值金额", | ||
668 | + "score": "赠送板币", | ||
669 | + "weigh": 1, | ||
670 | + }, | ||
671 | + ] | ||
571 | } | 672 | } |
572 | }) | 673 | }) |
573 | */ | 674 | */ |
574 | public function deposit() | 675 | public function deposit() |
575 | { | 676 | { |
576 | if($this->request->isPost()){ | 677 | if($this->request->isPost()){ |
577 | - $keyword = $this->request->param('keyword',''); | ||
578 | $where = [ | 678 | $where = [ |
579 | 'where' => [] | 679 | 'where' => [] |
580 | ]; | 680 | ]; |
581 | - if($keyword) { | ||
582 | - $where['where'] = ['name'=>['like','%'.$keyword.'%']]; | ||
583 | - } | ||
584 | - $indus = $this->industry_model->selectOrFail($where,false,'*','weigh'); | 681 | + $deposit = $this->deposit_model->selectOrFail($where,false,'*','weigh'); |
585 | $return = [ | 682 | $return = [ |
586 | - 'list' => $indus, | 683 | + 'list' => $deposit, |
587 | ]; | 684 | ]; |
588 | $this->success('请求成功',$return); | 685 | $this->success('请求成功',$return); |
589 | } | 686 | } |
@@ -635,6 +732,7 @@ class Store extends Api | @@ -635,6 +732,7 @@ class Store extends Api | ||
635 | $order_result = $payment->pay($order); | 732 | $order_result = $payment->pay($order); |
636 | if($order_result['return_code'] == 'SUCCESS' && $order_result['result_code'] == 'SUCCESS') { | 733 | if($order_result['return_code'] == 'SUCCESS' && $order_result['result_code'] == 'SUCCESS') { |
637 | $prepayId = $order_result->prepay_id; | 734 | $prepayId = $order_result->prepay_id; |
735 | + $pay_data = $payment->configForJSSDKPayment($prepayId); // 返回数组 | ||
638 | } else { | 736 | } else { |
639 | $this->error($order_result['return_msg']); | 737 | $this->error($order_result['return_msg']); |
640 | } | 738 | } |
application/api/interfaces/UserInterface.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\api\library\Exception; | ||
4 | + | ||
5 | +use think\Exception; | ||
6 | + | ||
7 | +class BaseException extends Exception{ | ||
8 | + public $code = -1; | ||
9 | + public $msg ='参数错误'; | ||
10 | + public $errCode = 200; | ||
11 | + | ||
12 | + public function __construct($params=[]) { | ||
13 | + if(!is_array($params)){ | ||
14 | + return ; | ||
15 | +// throw new Exception('参数必须是数组'); | ||
16 | + } | ||
17 | + if(array_key_exists('code',$params)){ | ||
18 | + $this->code = $params['code']; | ||
19 | + } | ||
20 | + if(array_key_exists('msg',$params)){ | ||
21 | + $this->msg = $params['msg']; | ||
22 | + } | ||
23 | + if(array_key_exists('errCode',$params)){ | ||
24 | + $this->errCode = $params['errCode']; | ||
25 | + } | ||
26 | + } | ||
27 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\api\library\Exception; | ||
4 | + | ||
5 | + | ||
6 | + | ||
7 | +use Throwable; | ||
8 | + | ||
9 | +class DataMissException extends BaseException { | ||
10 | + public $code = -1; | ||
11 | + public $msg ='数据查询不到'; | ||
12 | + public $errCode = 200; | ||
13 | + | ||
14 | + public function __construct($message = "", $code = 0, Throwable $previous = null) | ||
15 | + { | ||
16 | + parent::__construct($message, $code, $previous); | ||
17 | + if(!empty($message)){ | ||
18 | + $this->message = $message; | ||
19 | + } | ||
20 | + } | ||
21 | +} |
application/api/providers/HookProviders.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\api\providers; | ||
4 | + | ||
5 | + | ||
6 | +use app\api\interfaces\HookProvidersInterface; | ||
7 | + | ||
8 | +class HookProviders implements HookProvidersInterface { | ||
9 | + static private $providers; | ||
10 | + static private $instance; | ||
11 | + | ||
12 | + public static function getInstance() | ||
13 | + { | ||
14 | + //判断$instance是否是Singleton的对象,不是则创建 | ||
15 | + if (!self::$instance instanceof self) { | ||
16 | + self::$instance = new self(); | ||
17 | + } | ||
18 | + return self::$instance; | ||
19 | + } | ||
20 | + | ||
21 | + public function getProviders(){ | ||
22 | + self::$providers = [ | ||
23 | + 'user'=>[ | ||
24 | + 'user_init' => [ | ||
25 | + 'app\\api\\behavior\\user\\User', | ||
26 | + ], | ||
27 | + ] | ||
28 | + ]; | ||
29 | + return self::$providers; | ||
30 | + } | ||
31 | +} |
application/api/services/UserServices.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\api\services; | ||
4 | + | ||
5 | +use app\api\interfaces\UserInterface; | ||
6 | + | ||
7 | +class UserServices implements UserInterface{ | ||
8 | + | ||
9 | + public function chi($params) | ||
10 | + { | ||
11 | + // TODO: Implement chi() method. | ||
12 | + } | ||
13 | + | ||
14 | + public function he($params) | ||
15 | + { | ||
16 | + // TODO: Implement chi() method. | ||
17 | + } | ||
18 | + | ||
19 | + public function la($params) | ||
20 | + { | ||
21 | + // TODO: Implement chi() method. | ||
22 | + } | ||
23 | + | ||
24 | + public function sa($params) | ||
25 | + { | ||
26 | + // TODO: Implement chi() method. | ||
27 | + } | ||
28 | + | ||
29 | +} |
@@ -36,6 +36,7 @@ class StoreValidate extends BaseValidate | @@ -36,6 +36,7 @@ class StoreValidate extends BaseValidate | ||
36 | 'store_inform_add' => ['content','images','house_ids','type'], // 发布信息 | 36 | 'store_inform_add' => ['content','images','house_ids','type'], // 发布信息 |
37 | 'red' => ['red_package','number'], // 发布信息红包 | 37 | 'red' => ['red_package','number'], // 发布信息红包 |
38 | 'house_new' => ['house_ids'], // 绑定社区 | 38 | 'house_new' => ['house_ids'], // 绑定社区 |
39 | + 'comment_detail' => ['comment_id'], // 留言详情 | ||
39 | 'comment_reply' => ['comment_id','content'], // 留言回复 | 40 | 'comment_reply' => ['comment_id','content'], // 留言回复 |
40 | 'deposit_order' => ['deposit_id'], // 板币充值提交 | 41 | 'deposit_order' => ['deposit_id'], // 板币充值提交 |
41 | ]; | 42 | ]; |
@@ -49,7 +49,68 @@ class Ajax extends Frontend | @@ -49,7 +49,68 @@ class Ajax extends Frontend | ||
49 | } | 49 | } |
50 | 50 | ||
51 | /** | 51 | /** |
52 | - * 支付结果回调 | 52 | + * 支付回调 |
53 | + */ | ||
54 | + public function notify(){ | ||
55 | + $app = new Application(ConfigService::load()); | ||
56 | + $response = $app->payment->handleNotify(function($notify, $successful){ | ||
57 | + /*这里是支付回调逻辑处理,一下是DEMO*/ | ||
58 | + // 使用通知里的 "微信支付订单号" 或者 "商户订单号" 去自己的数据库找到订单 | ||
59 | + $out_trade_no=$notify->out_trade_no; | ||
60 | + $info = Db::name('deposit_order')->where(['order_sn'=>$out_trade_no])->find(); | ||
61 | + if (!$info) { // 如果订单不存在 | ||
62 | + return 'Order not exist.'; // 告诉微信,我已经处理完了,订单没找到,别再通知我了 | ||
63 | + } | ||
64 | + | ||
65 | + // 检查订单是否已经更新过支付状态 | ||
66 | + if ($info['transaction_id']) { // 假设订单字段“支付时间”不为空代表已经支付 | ||
67 | + return true; // 已经支付成功了就不再更新了 | ||
68 | + } | ||
69 | + | ||
70 | + // 用户是否支付成功 | ||
71 | + if ($successful) { | ||
72 | + Db::startTrans(); | ||
73 | + // 回填微信的订单号 | ||
74 | + $update['transaction_id'] = $notify->transaction_id; | ||
75 | + $update['status'] = 0; //付款成功,接单中 | ||
76 | + $update['pay_time'] = time(); | ||
77 | + //更新状态: 已购买 | ||
78 | + $res_order = Db::name('deposit_order')->where(['id' => $info['id']])->update($update); | ||
79 | + $user = Db::name('user')->where('id',$info['user_id'])->find(); | ||
80 | + | ||
81 | + //记录钱包log | ||
82 | + $insert_data = array( | ||
83 | + 'user_id' => $info['user_id'], | ||
84 | + 'score' => $info['score'], | ||
85 | + 'before' => $user['score'], | ||
86 | + 'after' => $user['score'] + $info['score'], | ||
87 | + 'createtime' => time(), | ||
88 | + 'memo' => '充值', | ||
89 | + ); | ||
90 | + $res_log = Db::name('user_score_log')->insert($insert_data); | ||
91 | + // 增加用户板币余额 | ||
92 | + $res_user = Db::name('user')->where('id',$info['user_id'])->setInc('score',$info['score']); | ||
93 | + if(!$res_order || !$res_log || !$res_user) { | ||
94 | + Db::rollback(); | ||
95 | + return false; // 返回处理完成 | ||
96 | + } | ||
97 | + Db::commit(); | ||
98 | + } else { | ||
99 | + // 用户支付失败 | ||
100 | + $update['transaction_id'] = $notify->transaction_id; | ||
101 | + $update['status'] = 6; //异常-支付失败 | ||
102 | + Db::name('deposit_order')->where(['id' => $info['id']])->update($update); | ||
103 | + return false; // 返回处理完成 | ||
104 | + } | ||
105 | + | ||
106 | + return true; // 返回处理完成 | ||
107 | + }); | ||
108 | + | ||
109 | + $response->send(); | ||
110 | + } | ||
111 | + | ||
112 | + /** | ||
113 | + * 商家入驻支付结果回调 | ||
53 | */ | 114 | */ |
54 | public function callback_for_wxgzh(){ | 115 | public function callback_for_wxgzh(){ |
55 | $this->init_wx_pay_for_gzh(false); | 116 | $this->init_wx_pay_for_gzh(false); |
此 diff 太大无法显示。
public/assets/js/backend/deposit/deposit.js
0 → 100644
1 | +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { | ||
2 | + | ||
3 | + var Controller = { | ||
4 | + index: function () { | ||
5 | + // 初始化表格参数配置 | ||
6 | + Table.api.init({ | ||
7 | + extend: { | ||
8 | + index_url: 'deposit/deposit/index' + location.search, | ||
9 | + add_url: 'deposit/deposit/add', | ||
10 | + edit_url: 'deposit/deposit/edit', | ||
11 | + del_url: 'deposit/deposit/del', | ||
12 | + multi_url: 'deposit/deposit/multi', | ||
13 | + table: 'deposit', | ||
14 | + } | ||
15 | + }); | ||
16 | + | ||
17 | + var table = $("#table"); | ||
18 | + | ||
19 | + // 初始化表格 | ||
20 | + table.bootstrapTable({ | ||
21 | + url: $.fn.bootstrapTable.defaults.extend.index_url, | ||
22 | + pk: 'id', | ||
23 | + sortName: 'weigh', | ||
24 | + columns: [ | ||
25 | + [ | ||
26 | + {checkbox: true}, | ||
27 | + {field: 'id', title: __('Id')}, | ||
28 | + {field: 'money', title: __('Money'), operate:'BETWEEN'}, | ||
29 | + {field: 'score', title: __('Score'), operate:'BETWEEN'}, | ||
30 | + {field: 'weigh', title: __('Weigh')}, | ||
31 | + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
32 | + {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
33 | + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | ||
34 | + ] | ||
35 | + ] | ||
36 | + }); | ||
37 | + | ||
38 | + // 为表格绑定事件 | ||
39 | + Table.api.bindevent(table); | ||
40 | + }, | ||
41 | + add: function () { | ||
42 | + Controller.api.bindevent(); | ||
43 | + }, | ||
44 | + edit: function () { | ||
45 | + Controller.api.bindevent(); | ||
46 | + }, | ||
47 | + api: { | ||
48 | + bindevent: function () { | ||
49 | + Form.api.bindevent($("form[role=form]")); | ||
50 | + } | ||
51 | + } | ||
52 | + }; | ||
53 | + return Controller; | ||
54 | +}); |
1 | +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { | ||
2 | + | ||
3 | + var Controller = { | ||
4 | + index: function () { | ||
5 | + // 初始化表格参数配置 | ||
6 | + Table.api.init({ | ||
7 | + extend: { | ||
8 | + index_url: 'deposit/deposit_order/index' + location.search, | ||
9 | + add_url: 'deposit/deposit_order/add', | ||
10 | + edit_url: 'deposit/deposit_order/edit', | ||
11 | + del_url: 'deposit/deposit_order/del', | ||
12 | + multi_url: 'deposit/deposit_order/multi', | ||
13 | + table: 'deposit_order', | ||
14 | + } | ||
15 | + }); | ||
16 | + | ||
17 | + var table = $("#table"); | ||
18 | + | ||
19 | + // 初始化表格 | ||
20 | + table.bootstrapTable({ | ||
21 | + url: $.fn.bootstrapTable.defaults.extend.index_url, | ||
22 | + pk: 'id', | ||
23 | + sortName: 'id', | ||
24 | + columns: [ | ||
25 | + [ | ||
26 | + {checkbox: true}, | ||
27 | + {field: 'id', title: __('Id')}, | ||
28 | + {field: 'order_sn', title: __('Order_sn')}, | ||
29 | + {field: 'user_id', title: __('User_id')}, | ||
30 | + {field: 'deposit_id', title: __('Deposit_id')}, | ||
31 | + {field: 'score', title: __('Score'), operate:'BETWEEN'}, | ||
32 | + {field: 'money', title: __('Money'), operate:'BETWEEN'}, | ||
33 | + {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status}, | ||
34 | + {field: 'pay_time', title: __('Pay_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
35 | + {field: 'transaction_id', title: __('Transaction_id')}, | ||
36 | + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
37 | + {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
38 | + {field: 'user.nickname', title: __('User.nickname')}, | ||
39 | + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | ||
40 | + ] | ||
41 | + ] | ||
42 | + }); | ||
43 | + | ||
44 | + // 为表格绑定事件 | ||
45 | + Table.api.bindevent(table); | ||
46 | + }, | ||
47 | + add: function () { | ||
48 | + Controller.api.bindevent(); | ||
49 | + }, | ||
50 | + edit: function () { | ||
51 | + Controller.api.bindevent(); | ||
52 | + }, | ||
53 | + api: { | ||
54 | + bindevent: function () { | ||
55 | + Form.api.bindevent($("form[role=form]")); | ||
56 | + } | ||
57 | + } | ||
58 | + }; | ||
59 | + return Controller; | ||
60 | +}); |
@@ -34,7 +34,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -34,7 +34,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
34 | {field: 'name', title: __('Name')}, | 34 | {field: 'name', title: __('Name')}, |
35 | {field: 'mobile', title: __('Mobile')}, | 35 | {field: 'mobile', title: __('Mobile')}, |
36 | {field: 'license', title: __('License'),operate: false,events:Table.api.events.image,formatter: Table.api.formatter.image}, | 36 | {field: 'license', title: __('License'),operate: false,events:Table.api.events.image,formatter: Table.api.formatter.image}, |
37 | - {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status}, | 37 | + {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3'),"4":__('Status 4')}, formatter: Table.api.formatter.status}, |
38 | {field: 'pay_time', title: __('Pay_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | 38 | {field: 'pay_time', title: __('Pay_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, |
39 | // {field: 'province', title: __('Province')}, | 39 | // {field: 'province', title: __('Province')}, |
40 | // {field: 'city', title: __('City')}, | 40 | // {field: 'city', title: __('City')}, |
@@ -51,7 +51,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -51,7 +51,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
51 | icon: 'fa fa-edit', | 51 | icon: 'fa fa-edit', |
52 | url: $.fn.bootstrapTable.defaults.extend.examine_url, | 52 | url: $.fn.bootstrapTable.defaults.extend.examine_url, |
53 | visible:function (row) { | 53 | visible:function (row) { |
54 | - if(row.status == 1){ | 54 | + if(row.status == 2){ |
55 | return true; | 55 | return true; |
56 | }else{ | 56 | }else{ |
57 | return false; | 57 | return false; |
-
请 注册 或 登录 后发表评论