正在显示
22 个修改的文件
包含
1018 行增加
和
8 行删除
application/admin/controller/Industry.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 行业管理 | ||
9 | + * | ||
10 | + * @icon fa fa-industry | ||
11 | + */ | ||
12 | +class Industry extends Backend | ||
13 | +{ | ||
14 | + | ||
15 | + /** | ||
16 | + * Industry模型对象 | ||
17 | + * @var \app\admin\model\Industry | ||
18 | + */ | ||
19 | + protected $model = null; | ||
20 | + | ||
21 | + public function _initialize() | ||
22 | + { | ||
23 | + parent::_initialize(); | ||
24 | + $this->model = new \app\admin\model\Industry; | ||
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 | +} |
@@ -18,6 +18,7 @@ class Litestorecategory extends Backend | @@ -18,6 +18,7 @@ class Litestorecategory extends Backend | ||
18 | */ | 18 | */ |
19 | protected $model = null; | 19 | protected $model = null; |
20 | protected $categorylist = []; | 20 | protected $categorylist = []; |
21 | + protected $noNeedRight = ['selectpage']; | ||
21 | 22 | ||
22 | public function _initialize() | 23 | public function _initialize() |
23 | { | 24 | { |
@@ -53,13 +53,11 @@ class Litestoreorder extends Backend | @@ -53,13 +53,11 @@ class Litestoreorder extends Backend | ||
53 | } | 53 | } |
54 | list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | 54 | list($where, $sort, $order, $offset, $limit) = $this->buildparams(); |
55 | $total = $this->model | 55 | $total = $this->model |
56 | - ->with(['address']) | ||
57 | ->where($where) | 56 | ->where($where) |
58 | ->order($sort, $order) | 57 | ->order($sort, $order) |
59 | ->count(); | 58 | ->count(); |
60 | 59 | ||
61 | $list = $this->model | 60 | $list = $this->model |
62 | - ->with(['address']) | ||
63 | ->where($where) | 61 | ->where($where) |
64 | ->order($sort, $order) | 62 | ->order($sort, $order) |
65 | ->limit($offset, $limit) | 63 | ->limit($offset, $limit) |
@@ -67,8 +65,6 @@ class Litestoreorder extends Backend | @@ -67,8 +65,6 @@ class Litestoreorder extends Backend | ||
67 | 65 | ||
68 | foreach ($list as $row) { | 66 | foreach ($list as $row) { |
69 | $row->visible(['id','order_no','total_price','pay_price','pay_time','express_price','freight_time','receipt_time','order_status','updatetime']); | 67 | $row->visible(['id','order_no','total_price','pay_price','pay_time','express_price','freight_time','receipt_time','order_status','updatetime']); |
70 | - $row->visible(['address']); | ||
71 | - $row->getRelation('address')->visible(['name']); | ||
72 | } | 68 | } |
73 | $list = collection($list)->toArray(); | 69 | $list = collection($list)->toArray(); |
74 | $result = array("total" => $total, "rows" => $list); | 70 | $result = array("total" => $total, "rows" => $list); |
application/admin/controller/store/Store.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\store; | ||
4 | + | ||
5 | +use app\admin\model\Admin; | ||
6 | +use app\admin\model\AuthGroupAccess; | ||
7 | +use app\common\controller\Backend; | ||
8 | +use fast\Random; | ||
9 | +use think\Db; | ||
10 | +use think\Exception; | ||
11 | +use think\exception\PDOException; | ||
12 | +use think\exception\ValidateException; | ||
13 | + | ||
14 | +/** | ||
15 | + * 商家入驻订单管理 | ||
16 | + * | ||
17 | + * @icon fa fa-circle-o | ||
18 | + */ | ||
19 | +class Store extends Backend | ||
20 | +{ | ||
21 | + | ||
22 | + /** | ||
23 | + * Store模型对象 | ||
24 | + * @var \app\admin\model\store\Store | ||
25 | + */ | ||
26 | + protected $model = null; | ||
27 | + | ||
28 | + public function _initialize() | ||
29 | + { | ||
30 | + parent::_initialize(); | ||
31 | + $this->model = new \app\admin\model\store\Store; | ||
32 | + $this->view->assign("statusList", $this->model->getStatusList()); | ||
33 | + } | ||
34 | + | ||
35 | + /** | ||
36 | + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 | ||
37 | + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 | ||
38 | + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 | ||
39 | + */ | ||
40 | + | ||
41 | + | ||
42 | + /** | ||
43 | + * 查看 | ||
44 | + */ | ||
45 | + public function index() | ||
46 | + { | ||
47 | + //当前是否为关联查询 | ||
48 | + $this->relationSearch = true; | ||
49 | + //设置过滤方法 | ||
50 | + $this->request->filter(['strip_tags', 'trim']); | ||
51 | + if ($this->request->isAjax()) | ||
52 | + { | ||
53 | + //如果发送的来源是Selectpage,则转发到Selectpage | ||
54 | + if ($this->request->request('keyField')) | ||
55 | + { | ||
56 | + return $this->selectpage(); | ||
57 | + } | ||
58 | + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | ||
59 | + $total = $this->model | ||
60 | + ->with(['admin','user','industry']) | ||
61 | + ->where($where) | ||
62 | + ->order($sort, $order) | ||
63 | + ->count(); | ||
64 | + | ||
65 | + $list = $this->model | ||
66 | + ->with(['admin','user','industry']) | ||
67 | + ->where($where) | ||
68 | + ->order($sort, $order) | ||
69 | + ->limit($offset, $limit) | ||
70 | + ->select(); | ||
71 | + | ||
72 | + foreach ($list as $row) { | ||
73 | + | ||
74 | + $row->getRelation('admin')->visible(['nickname']); | ||
75 | + $row->getRelation('user')->visible(['nickname']); | ||
76 | + $row->getRelation('industry')->visible(['name']); | ||
77 | + } | ||
78 | + $list = collection($list)->toArray(); | ||
79 | + $result = array("total" => $total, "rows" => $list); | ||
80 | + | ||
81 | + return json($result); | ||
82 | + } | ||
83 | + return $this->view->fetch(); | ||
84 | + } | ||
85 | + | ||
86 | + /** | ||
87 | + * 审核 | ||
88 | + */ | ||
89 | + public function examine($ids = null) | ||
90 | + { | ||
91 | + $row = $this->model->get($ids); | ||
92 | + if (!$row) { | ||
93 | + $this->error(__('No Results were found')); | ||
94 | + } | ||
95 | + $adminIds = $this->getDataLimitAdminIds(); | ||
96 | + if (is_array($adminIds)) { | ||
97 | + if (!in_array($row[$this->dataLimitField], $adminIds)) { | ||
98 | + $this->error(__('You have no permission')); | ||
99 | + } | ||
100 | + } | ||
101 | + if ($this->request->isPost()) { | ||
102 | + $params = $this->request->post("row/a"); | ||
103 | + if ($params) { | ||
104 | + $params = $this->preExcludeFields($params); | ||
105 | + $admin_model = new Admin(); | ||
106 | + $auth_group_model = new AuthGroupAccess(); | ||
107 | + if($params['status'] == 2) { | ||
108 | + $salt = Random::alnum(); | ||
109 | + $password = md5(md5($params['password']) . $salt); | ||
110 | + $admin_data = [ | ||
111 | + 'username' => $params['username'], | ||
112 | + 'nickname' => $params['nickname'], | ||
113 | + 'salt' => $salt, | ||
114 | + 'password' => $password | ||
115 | + ]; | ||
116 | + $auth_group_data = [ | ||
117 | + 'group_id' => 4, | ||
118 | + ]; | ||
119 | + } | ||
120 | + $result = false; | ||
121 | + $result_admin = $result_auth_group = true; | ||
122 | + Db::startTrans(); | ||
123 | + try { | ||
124 | + $result = $row->allowField(true)->save($params); | ||
125 | + // 判断审核状态 | ||
126 | + if($params['status'] == 2) { | ||
127 | + // 审核通过,新增商家管理员 | ||
128 | + $result_admin = $admin_model->isUpdate(false)->save($admin_data); | ||
129 | + $auth_group_data['uid'] = $admin_model->id; | ||
130 | + $result_auth_group = $auth_group_model->isUpdate(false)->save($auth_group_data); | ||
131 | + } | ||
132 | + if($params['status'] == 3) { | ||
133 | + // 审核不通过,执行退款操作 | ||
134 | + $refund = [ | ||
135 | + 'order_id' => $row->id, | ||
136 | + 'user_id' => $row->user_id, | ||
137 | + 'order_sn' => $row->order_sn, | ||
138 | + 'transaction_id' => $row->transaction_id, | ||
139 | + 'out_refund_no' => date('Ymd').substr($row->order_sn,-8), | ||
140 | + 'price' => $row->money | ||
141 | + ]; | ||
142 | + $this->refund($refund); | ||
143 | + } | ||
144 | + Db::commit(); | ||
145 | + } catch (ValidateException $e) { | ||
146 | + Db::rollback(); | ||
147 | + $this->error($e->getMessage()); | ||
148 | + } catch (PDOException $e) { | ||
149 | + Db::rollback(); | ||
150 | + $this->error($e->getMessage()); | ||
151 | + } catch (Exception $e) { | ||
152 | + Db::rollback(); | ||
153 | + $this->error($e->getMessage()); | ||
154 | + } | ||
155 | + if ($result !== false && $result_admin !== false && $result_auth_group !== false) { | ||
156 | + $this->success(); | ||
157 | + } else { | ||
158 | + $this->error(__('No rows were updated')); | ||
159 | + } | ||
160 | + } | ||
161 | + $this->error(__('Parameter %s can not be empty', '')); | ||
162 | + } | ||
163 | + $this->view->assign('row',$row); | ||
164 | + return $this->view->fetch(); | ||
165 | + } | ||
166 | +} |
application/admin/lang/zh-cn/industry.php
0 → 100644
application/admin/lang/zh-cn/store/store.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +return [ | ||
4 | + 'Order_sn' => '订单编号', | ||
5 | + 'User_id' => '用户id', | ||
6 | + 'Admin_id' => '后台管理员id', | ||
7 | + 'House_ids' => '社区id', | ||
8 | + 'Store_name' => '店铺名称', | ||
9 | + 'Industry_id' => '行业/关键词', | ||
10 | + 'Name' => '联系人姓名', | ||
11 | + 'Mobile' => '联系人手机号', | ||
12 | + 'License' => '营业执照', | ||
13 | + 'Status' => '状态', | ||
14 | + 'Status 1' => '待审核', | ||
15 | + 'Status 2' => '审核通过', | ||
16 | + 'Status 3' => '审核驳回', | ||
17 | + 'Pay_time' => '支付时间', | ||
18 | + 'Transaction_id' => '微信支付ID', | ||
19 | + 'Store_icon' => '店铺图标', | ||
20 | + 'City' => '市', | ||
21 | + 'Region' => '区', | ||
22 | + 'Images' => '宣传图', | ||
23 | + 'Createtime' => '生成时间', | ||
24 | + 'Updatetime' => '更新时间', | ||
25 | + 'Admin.nickname' => '昵称', | ||
26 | + 'Username' => '后台账号', | ||
27 | + 'Password' => '后台密码', | ||
28 | + 'User.nickname' => '昵称', | ||
29 | + 'Industry.name' => '名称' | ||
30 | +]; |
application/admin/model/Industry.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\model; | ||
4 | + | ||
5 | +use think\Model; | ||
6 | + | ||
7 | + | ||
8 | +class Industry extends Model | ||
9 | +{ | ||
10 | + | ||
11 | + | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + // 表名 | ||
16 | + protected $name = 'industry'; | ||
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 | +} |
application/admin/model/store/Store.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\model\store; | ||
4 | + | ||
5 | +use think\Model; | ||
6 | + | ||
7 | + | ||
8 | +class Store extends Model | ||
9 | +{ | ||
10 | + | ||
11 | + | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + // 表名 | ||
16 | + protected $name = 'store'; | ||
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'), '3' => __('Status 3')]; | ||
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 admin() | ||
61 | + { | ||
62 | + return $this->belongsTo('app\admin\model\Admin', 'admin_id', 'id', [], 'LEFT')->setEagerlyType(0); | ||
63 | + } | ||
64 | + | ||
65 | + | ||
66 | + public function user() | ||
67 | + { | ||
68 | + return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); | ||
69 | + } | ||
70 | + | ||
71 | + | ||
72 | + public function industry() | ||
73 | + { | ||
74 | + return $this->belongsTo('app\admin\model\Industry', 'industry_id', 'id', [], 'LEFT')->setEagerlyType(0); | ||
75 | + } | ||
76 | +} |
application/admin/validate/Industry.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\validate; | ||
4 | + | ||
5 | +use think\Validate; | ||
6 | + | ||
7 | +class Industry 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 | +} |
application/admin/validate/store/Store.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\validate\store; | ||
4 | + | ||
5 | +use think\Validate; | ||
6 | + | ||
7 | +class Store 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 | +} |
application/admin/view/industry/add.html
0 → 100644
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">{:__('Name')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value=""> | ||
7 | + </div> | ||
8 | + </div> | ||
9 | + <div class="form-group"> | ||
10 | + <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label> | ||
11 | + <div class="col-xs-12 col-sm-8"> | ||
12 | + <input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="0"> | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + <div class="form-group layer-footer"> | ||
16 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
17 | + <div class="col-xs-12 col-sm-8"> | ||
18 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
19 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
20 | + </div> | ||
21 | + </div> | ||
22 | +</form> |
application/admin/view/industry/edit.html
0 → 100644
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">{:__('Name')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}"> | ||
7 | + </div> | ||
8 | + </div> | ||
9 | + <div class="form-group"> | ||
10 | + <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label> | ||
11 | + <div class="col-xs-12 col-sm-8"> | ||
12 | + <input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}"> | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + <div class="form-group layer-footer"> | ||
16 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
17 | + <div class="col-xs-12 col-sm-8"> | ||
18 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
19 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
20 | + </div> | ||
21 | + </div> | ||
22 | +</form> |
application/admin/view/industry/index.html
0 → 100644
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('industry/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('industry/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('industry/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a> | ||
13 | +<!-- <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('industry/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('industry/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('industry/edit')}" | ||
27 | + data-operate-del="{:$auth->check('industry/del')}" | ||
28 | + width="100%"> | ||
29 | + </table> | ||
30 | + </div> | ||
31 | + </div> | ||
32 | + | ||
33 | + </div> | ||
34 | + </div> | ||
35 | +</div> |
application/admin/view/store/store/add.html
0 → 100644
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">{:__('House_ids')}:</label> | ||
17 | + <div class="col-xs-12 col-sm-8"> | ||
18 | + <input id="c-house_ids" data-rule="required" data-source="house/index" data-multiple="true" class="form-control selectpage" name="row[house_ids]" type="text" value=""> | ||
19 | + </div> | ||
20 | + </div> | ||
21 | + <div class="form-group"> | ||
22 | + <label class="control-label col-xs-12 col-sm-2">{:__('Store_name')}:</label> | ||
23 | + <div class="col-xs-12 col-sm-8"> | ||
24 | + <input id="c-store_name" data-rule="required" class="form-control" name="row[store_name]" type="text" value="''"> | ||
25 | + </div> | ||
26 | + </div> | ||
27 | + <div class="form-group"> | ||
28 | + <label class="control-label col-xs-12 col-sm-2">{:__('Industry_id')}:</label> | ||
29 | + <div class="col-xs-12 col-sm-8"> | ||
30 | + <input id="c-industry_id" data-rule="required" data-source="industry/index" class="form-control selectpage" name="row[industry_id]" type="text" value=""> | ||
31 | + </div> | ||
32 | + </div> | ||
33 | + <div class="form-group"> | ||
34 | + <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label> | ||
35 | + <div class="col-xs-12 col-sm-8"> | ||
36 | + <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="''"> | ||
37 | + </div> | ||
38 | + </div> | ||
39 | + <div class="form-group"> | ||
40 | + <label class="control-label col-xs-12 col-sm-2">{:__('Mobile')}:</label> | ||
41 | + <div class="col-xs-12 col-sm-8"> | ||
42 | + <input id="c-mobile" data-rule="required" class="form-control" name="row[mobile]" type="text" value="''"> | ||
43 | + </div> | ||
44 | + </div> | ||
45 | + <div class="form-group"> | ||
46 | + <label class="control-label col-xs-12 col-sm-2">{:__('License')}:</label> | ||
47 | + <div class="col-xs-12 col-sm-8"> | ||
48 | + <input id="c-license" data-rule="required" class="form-control" name="row[license]" type="text" value="''"> | ||
49 | + </div> | ||
50 | + </div> | ||
51 | + <div class="form-group"> | ||
52 | + <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label> | ||
53 | + <div class="col-xs-12 col-sm-8"> | ||
54 | + | ||
55 | + <div class="radio"> | ||
56 | + {foreach name="statusList" item="vo"} | ||
57 | + <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> | ||
58 | + {/foreach} | ||
59 | + </div> | ||
60 | + | ||
61 | + </div> | ||
62 | + </div> | ||
63 | + <div class="form-group"> | ||
64 | + <label class="control-label col-xs-12 col-sm-2">{:__('Pay_time')}:</label> | ||
65 | + <div class="col-xs-12 col-sm-8"> | ||
66 | + <input id="c-pay_time" data-rule="required" 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')}"> | ||
67 | + </div> | ||
68 | + </div> | ||
69 | + <div class="form-group"> | ||
70 | + <label class="control-label col-xs-12 col-sm-2">{:__('Transaction_id')}:</label> | ||
71 | + <div class="col-xs-12 col-sm-8"> | ||
72 | + <input id="c-transaction_id" data-rule="required" data-source="transaction/index" class="form-control selectpage" name="row[transaction_id]" type="text" value=""> | ||
73 | + </div> | ||
74 | + </div> | ||
75 | + <div class="form-group"> | ||
76 | + <label class="control-label col-xs-12 col-sm-2">{:__('Store_icon')}:</label> | ||
77 | + <div class="col-xs-12 col-sm-8"> | ||
78 | + <input id="c-store_icon" class="form-control" name="row[store_icon]" type="text" value="''"> | ||
79 | + </div> | ||
80 | + </div> | ||
81 | + <div class="form-group"> | ||
82 | + <label class="control-label col-xs-12 col-sm-2">{:__('Province')}:</label> | ||
83 | + <div class="col-xs-12 col-sm-8"> | ||
84 | + <input id="c-province" class="form-control" name="row[province]" type="text" value="NULL"> | ||
85 | + </div> | ||
86 | + </div> | ||
87 | + <div class="form-group"> | ||
88 | + <label class="control-label col-xs-12 col-sm-2">{:__('City')}:</label> | ||
89 | + <div class="col-xs-12 col-sm-8"> | ||
90 | + <div class='control-relative'><input id="c-city" class="form-control" data-toggle="city-picker" name="row[city]" type="text" value="''"></div> | ||
91 | + </div> | ||
92 | + </div> | ||
93 | + <div class="form-group"> | ||
94 | + <label class="control-label col-xs-12 col-sm-2">{:__('Region')}:</label> | ||
95 | + <div class="col-xs-12 col-sm-8"> | ||
96 | + <input id="c-region" class="form-control" name="row[region]" type="text" value="''"> | ||
97 | + </div> | ||
98 | + </div> | ||
99 | + <div class="form-group"> | ||
100 | + <label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label> | ||
101 | + <div class="col-xs-12 col-sm-8"> | ||
102 | + <div class="input-group"> | ||
103 | + <input id="c-images" class="form-control" size="50" name="row[images]" type="textarea" value="NULL"> | ||
104 | + <div class="input-group-addon no-border no-padding"> | ||
105 | + <span><button type="button" id="plupload-images" class="btn btn-danger plupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span> | ||
106 | + <span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span> | ||
107 | + </div> | ||
108 | + <span class="msg-box n-right" for="c-images"></span> | ||
109 | + </div> | ||
110 | + <ul class="row list-inline plupload-preview" id="p-images"></ul> | ||
111 | + </div> | ||
112 | + </div> | ||
113 | + <div class="form-group layer-footer"> | ||
114 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
115 | + <div class="col-xs-12 col-sm-8"> | ||
116 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
117 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
118 | + </div> | ||
119 | + </div> | ||
120 | +</form> |
application/admin/view/store/store/edit.html
0 → 100644
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">{:__('House_ids')}:</label> | ||
17 | + <div class="col-xs-12 col-sm-8"> | ||
18 | + <input id="c-house_ids" data-rule="required" data-source="house/index" data-multiple="true" class="form-control selectpage" name="row[house_ids]" type="text" value="{$row.house_ids|htmlentities}"> | ||
19 | + </div> | ||
20 | + </div> | ||
21 | + <div class="form-group"> | ||
22 | + <label class="control-label col-xs-12 col-sm-2">{:__('Store_name')}:</label> | ||
23 | + <div class="col-xs-12 col-sm-8"> | ||
24 | + <input id="c-store_name" data-rule="required" class="form-control" name="row[store_name]" type="text" value="{$row.store_name|htmlentities}"> | ||
25 | + </div> | ||
26 | + </div> | ||
27 | + <div class="form-group"> | ||
28 | + <label class="control-label col-xs-12 col-sm-2">{:__('Industry_id')}:</label> | ||
29 | + <div class="col-xs-12 col-sm-8"> | ||
30 | + <input id="c-industry_id" data-rule="required" data-source="industry/index" class="form-control selectpage" name="row[industry_id]" type="text" value="{$row.industry_id|htmlentities}"> | ||
31 | + </div> | ||
32 | + </div> | ||
33 | + <div class="form-group"> | ||
34 | + <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label> | ||
35 | + <div class="col-xs-12 col-sm-8"> | ||
36 | + <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}"> | ||
37 | + </div> | ||
38 | + </div> | ||
39 | + <div class="form-group"> | ||
40 | + <label class="control-label col-xs-12 col-sm-2">{:__('Mobile')}:</label> | ||
41 | + <div class="col-xs-12 col-sm-8"> | ||
42 | + <input id="c-mobile" data-rule="required" class="form-control" name="row[mobile]" type="text" value="{$row.mobile|htmlentities}"> | ||
43 | + </div> | ||
44 | + </div> | ||
45 | + <div class="form-group"> | ||
46 | + <label class="control-label col-xs-12 col-sm-2">{:__('License')}:</label> | ||
47 | + <div class="col-xs-12 col-sm-8"> | ||
48 | + <input id="c-license" data-rule="required" class="form-control" name="row[license]" type="text" value="{$row.license|htmlentities}"> | ||
49 | + </div> | ||
50 | + </div> | ||
51 | + <div class="form-group"> | ||
52 | + <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label> | ||
53 | + <div class="col-xs-12 col-sm-8"> | ||
54 | + | ||
55 | + <div class="radio"> | ||
56 | + {foreach name="statusList" item="vo"} | ||
57 | + <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> | ||
58 | + {/foreach} | ||
59 | + </div> | ||
60 | + | ||
61 | + </div> | ||
62 | + </div> | ||
63 | + <div class="form-group"> | ||
64 | + <label class="control-label col-xs-12 col-sm-2">{:__('Pay_time')}:</label> | ||
65 | + <div class="col-xs-12 col-sm-8"> | ||
66 | + <input id="c-pay_time" data-rule="required" 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):''}"> | ||
67 | + </div> | ||
68 | + </div> | ||
69 | + <div class="form-group"> | ||
70 | + <label class="control-label col-xs-12 col-sm-2">{:__('Transaction_id')}:</label> | ||
71 | + <div class="col-xs-12 col-sm-8"> | ||
72 | + <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}"> | ||
73 | + </div> | ||
74 | + </div> | ||
75 | + <div class="form-group"> | ||
76 | + <label class="control-label col-xs-12 col-sm-2">{:__('Store_icon')}:</label> | ||
77 | + <div class="col-xs-12 col-sm-8"> | ||
78 | + <input id="c-store_icon" class="form-control" name="row[store_icon]" type="text" value="{$row.store_icon|htmlentities}"> | ||
79 | + </div> | ||
80 | + </div> | ||
81 | + <div class="form-group"> | ||
82 | + <label class="control-label col-xs-12 col-sm-2">{:__('Province')}:</label> | ||
83 | + <div class="col-xs-12 col-sm-8"> | ||
84 | + <input id="c-province" class="form-control" name="row[province]" type="text" value="{$row.province|htmlentities}"> | ||
85 | + </div> | ||
86 | + </div> | ||
87 | + <div class="form-group"> | ||
88 | + <label class="control-label col-xs-12 col-sm-2">{:__('City')}:</label> | ||
89 | + <div class="col-xs-12 col-sm-8"> | ||
90 | + <div class='control-relative'><input id="c-city" class="form-control" data-toggle="city-picker" name="row[city]" type="text" value="{$row.city|htmlentities}"></div> | ||
91 | + </div> | ||
92 | + </div> | ||
93 | + <div class="form-group"> | ||
94 | + <label class="control-label col-xs-12 col-sm-2">{:__('Region')}:</label> | ||
95 | + <div class="col-xs-12 col-sm-8"> | ||
96 | + <input id="c-region" class="form-control" name="row[region]" type="text" value="{$row.region|htmlentities}"> | ||
97 | + </div> | ||
98 | + </div> | ||
99 | + <div class="form-group"> | ||
100 | + <label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label> | ||
101 | + <div class="col-xs-12 col-sm-8"> | ||
102 | + <div class="input-group"> | ||
103 | + <input id="c-images" class="form-control" size="50" name="row[images]" type="textarea" value="{$row.images|htmlentities}"> | ||
104 | + <div class="input-group-addon no-border no-padding"> | ||
105 | + <span><button type="button" id="plupload-images" class="btn btn-danger plupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span> | ||
106 | + <span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span> | ||
107 | + </div> | ||
108 | + <span class="msg-box n-right" for="c-images"></span> | ||
109 | + </div> | ||
110 | + <ul class="row list-inline plupload-preview" id="p-images"></ul> | ||
111 | + </div> | ||
112 | + </div> | ||
113 | + <div class="form-group layer-footer"> | ||
114 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
115 | + <div class="col-xs-12 col-sm-8"> | ||
116 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
117 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
118 | + </div> | ||
119 | + </div> | ||
120 | +</form> |
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | <div class="form-group"> | 9 | <div class="form-group"> |
10 | <label class="control-label col-xs-12 col-sm-2">{:__('Username')}:</label> | 10 | <label class="control-label col-xs-12 col-sm-2">{:__('Username')}:</label> |
11 | <div class="col-xs-12 col-sm-8"> | 11 | <div class="col-xs-12 col-sm-8"> |
12 | - <input id="c-mobile" data-rule="required" class="form-control" name="row[mobile]" type="text" value="{$row.mobile|htmlentities}"> | 12 | + <input id="c-username" data-rule="required" class="form-control" name="row[username]" type="text" value="{$row.mobile|htmlentities}"> |
13 | </div> | 13 | </div> |
14 | </div> | 14 | </div> |
15 | <div class="form-group"> | 15 | <div class="form-group"> |
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('store/store/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('store/store/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('store/store/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a> | ||
23 | +<!-- <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('store/store/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('store/store/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('store/store/edit')}" | ||
37 | + data-operate-del="{:$auth->check('store/store/del')}" | ||
38 | + width="100%"> | ||
39 | + </table> | ||
40 | + </div> | ||
41 | + </div> | ||
42 | + | ||
43 | + </div> | ||
44 | + </div> | ||
45 | +</div> |
@@ -2,9 +2,12 @@ | @@ -2,9 +2,12 @@ | ||
2 | 2 | ||
3 | namespace app\common\controller; | 3 | namespace app\common\controller; |
4 | 4 | ||
5 | +use addons\wechat\library\Config as ConfigService; | ||
5 | use app\admin\library\Auth; | 6 | use app\admin\library\Auth; |
7 | +use EasyWeChat\Foundation\Application; | ||
6 | use think\Config; | 8 | use think\Config; |
7 | use think\Controller; | 9 | use think\Controller; |
10 | +use think\Db; | ||
8 | use think\Hook; | 11 | use think\Hook; |
9 | use think\Lang; | 12 | use think\Lang; |
10 | use think\Loader; | 13 | use think\Loader; |
@@ -524,4 +527,19 @@ class Backend extends Controller | @@ -524,4 +527,19 @@ class Backend extends Controller | ||
524 | //刷新Token | 527 | //刷新Token |
525 | $this->request->token(); | 528 | $this->request->token(); |
526 | } | 529 | } |
530 | + | ||
531 | + /** | ||
532 | + * 退款 | ||
533 | + */ | ||
534 | + protected function refund($order) { | ||
535 | + $app = new Application(); | ||
536 | + $payment = $app->payment; | ||
537 | + //使用商户订单号退款 PS.其他形式参考文档 | ||
538 | + $orderNo = $order['order_sn'];//商户系统内部的订单号(out_trade_no) | ||
539 | + $refundNo = $order['out_refund_no'];//退款单号 | ||
540 | + $url = url('index/ajax/refund_notify',[],true,true); | ||
541 | + $result = $payment->refund($orderNo, $refundNo,$url, floatval($order['price'])*100); // 总金额 100, 退款 80,refundFee可选(为空时全额退款) | ||
542 | +// $result = $payment->refund($orderNo, $refundNo,$url, 1); // 总金额 100, 退款 80,refundFee可选(为空时全额退款) | ||
543 | + return $result; | ||
544 | + } | ||
527 | } | 545 | } |
@@ -3,6 +3,8 @@ | @@ -3,6 +3,8 @@ | ||
3 | namespace app\index\controller; | 3 | namespace app\index\controller; |
4 | 4 | ||
5 | use app\common\controller\Frontend; | 5 | use app\common\controller\Frontend; |
6 | +use EasyWeChat\Foundation\Application; | ||
7 | +use think\Db; | ||
6 | use think\Lang; | 8 | use think\Lang; |
7 | 9 | ||
8 | /** | 10 | /** |
@@ -12,7 +14,7 @@ use think\Lang; | @@ -12,7 +14,7 @@ use think\Lang; | ||
12 | class Ajax extends Frontend | 14 | class Ajax extends Frontend |
13 | { | 15 | { |
14 | 16 | ||
15 | - protected $noNeedLogin = ['lang']; | 17 | + protected $noNeedLogin = ['lang','refund_notify']; |
16 | protected $noNeedRight = ['*']; | 18 | protected $noNeedRight = ['*']; |
17 | protected $layout = ''; | 19 | protected $layout = ''; |
18 | 20 | ||
@@ -36,6 +38,81 @@ class Ajax extends Frontend | @@ -36,6 +38,81 @@ class Ajax extends Frontend | ||
36 | } | 38 | } |
37 | 39 | ||
38 | /** | 40 | /** |
41 | + * 退款结果回调 | ||
42 | + */ | ||
43 | + public function refund_notify() { | ||
44 | + $app = new Application(); | ||
45 | + $response = $app->payment->handleRefundNotify(function ($message, $reqInfo) { | ||
46 | +// Log::write(date('Y-m-d H:i') . '订单退款操作,返回数据:' . json_encode($message, JSON_UNESCAPED_UNICODE), 'order_refund'); | ||
47 | + // 其中 $message['req_info'] 获取到的是加密解密信息 | ||
48 | + // $reqInfo 成功时为1 | ||
49 | + // 你的业务逻辑... | ||
50 | + if($reqInfo) { | ||
51 | + $refund_where = [ | ||
52 | + 'order_sn' => $message['req_info']['out_trade_no'], | ||
53 | + 'transaction_id' => $message['req_info']['transaction_id'], | ||
54 | + 'out_refund_no' => $message['req_info']['out_refund_no'] | ||
55 | + ]; | ||
56 | + $refund = Db::name('Refund')->where($refund_where)->find(); | ||
57 | +// Log::write(date('Y-m-d H:i') . '订单退款操作1,返回数据:' . json_encode($refund, JSON_UNESCAPED_UNICODE), 'order_refund'); | ||
58 | + if($refund['status'] == 1) { | ||
59 | + return true; | ||
60 | + } else { | ||
61 | + Db::startTrans(); | ||
62 | + $update = [ | ||
63 | + 'out_refund_no' => $message['req_info']['out_refund_no'], | ||
64 | + 'refund_id' => $message['req_info']['refund_id'], | ||
65 | + 'refund_account' => $message['req_info']['refund_account'], | ||
66 | + 'refund_request_source' => $message['req_info']['refund_request_source'], | ||
67 | + 'updatetime' => time(), | ||
68 | + 'more' => json_encode($message) | ||
69 | + ]; | ||
70 | + $ask_order_result = true; | ||
71 | + // 处理退款状态 | ||
72 | + if($message['req_info']['refund_status'] == 'SUCCESS') { | ||
73 | + $update['status'] = 1; | ||
74 | + $update['success_time'] = strtotime($message['req_info']['success_time']); | ||
75 | +// Log::write(date('Y-m-d H:i') . '订单退款操作2,返回数据:' . json_encode($update, JSON_UNESCAPED_UNICODE), 'order_refund'); | ||
76 | + if($refund['type'] == 1) { | ||
77 | + // 修改订单状态为已退款 | ||
78 | + $ask_order_update = [ | ||
79 | + 'id' => $refund['ask_order_id'], | ||
80 | + 'status' => 4 | ||
81 | + ]; | ||
82 | + $ask_order_result = Db::name('ask_order')->update($ask_order_update); | ||
83 | + } | ||
84 | + if($refund['type'] == 2) { | ||
85 | + // 修改订单状态为已退款 | ||
86 | + $ask_order_update = [ | ||
87 | + 'id' => $refund['ask_order_id'], | ||
88 | + 'status' => 2 | ||
89 | + ]; | ||
90 | + $ask_order_result = Db::name('ask_orderson')->update($ask_order_update); | ||
91 | + } | ||
92 | + } elseif($message['req_info']['refund_status'] == 'CHANGE') { | ||
93 | + $update['status'] = 2; | ||
94 | + } elseif($message['req_info']['refund_status'] == 'REFUNDCLOSE') { | ||
95 | + $update['status'] = 3; | ||
96 | + } | ||
97 | +// Log::write(date('Y-m-d H:i') . '订单退款操作3,返回数据:' . json_encode($refund_where, JSON_UNESCAPED_UNICODE), 'order_refund'); | ||
98 | + $result = Db::name('Refund')->where($refund_where)->update($update); | ||
99 | + if(!$result || !$ask_order_result) { | ||
100 | +// Log::write(date('Y-m-d H:i') . '订单退款操作5,返回数据:' . json_encode([$result,$ask_order_result], JSON_UNESCAPED_UNICODE), 'order_refund'); | ||
101 | + Db::rollback(); | ||
102 | + return false; | ||
103 | + } | ||
104 | +// Log::write(date('Y-m-d H:i') . '订单退款操作4,返回数据:' . json_encode([$result], JSON_UNESCAPED_UNICODE), 'order_refund'); | ||
105 | + Db::commit(); | ||
106 | + } | ||
107 | + } | ||
108 | + return true; // 返回 true 告诉微信“我已处理完成” | ||
109 | + // 或返回错误原因 $fail('参数格式校验错误'); | ||
110 | + }); | ||
111 | + | ||
112 | + $response->send(); | ||
113 | + } | ||
114 | + | ||
115 | + /** | ||
39 | * 上传文件 | 116 | * 上传文件 |
40 | */ | 117 | */ |
41 | public function upload() | 118 | public function upload() |
public/assets/js/backend/industry.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: 'industry/index' + location.search, | ||
9 | + add_url: 'industry/add', | ||
10 | + edit_url: 'industry/edit', | ||
11 | + del_url: 'industry/del', | ||
12 | + multi_url: 'industry/multi', | ||
13 | + table: 'industry', | ||
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: 'name', title: __('Name')}, | ||
29 | + {field: 'weigh', title: __('Weigh')}, | ||
30 | + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
31 | + {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
32 | + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | ||
33 | + ] | ||
34 | + ] | ||
35 | + }); | ||
36 | + | ||
37 | + // 为表格绑定事件 | ||
38 | + Table.api.bindevent(table); | ||
39 | + }, | ||
40 | + add: function () { | ||
41 | + Controller.api.bindevent(); | ||
42 | + }, | ||
43 | + edit: function () { | ||
44 | + Controller.api.bindevent(); | ||
45 | + }, | ||
46 | + api: { | ||
47 | + bindevent: function () { | ||
48 | + Form.api.bindevent($("form[role=form]")); | ||
49 | + } | ||
50 | + } | ||
51 | + }; | ||
52 | + return Controller; | ||
53 | +}); |
@@ -35,8 +35,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -35,8 +35,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
35 | {field: 'order_status', title: __('Order_status'), searchList: {"10":__('Order_status 10'),"20":__('Order_status 20'),"30":__('Order_status 30')}, | 35 | {field: 'order_status', title: __('Order_status'), searchList: {"10":__('Order_status 10'),"20":__('Order_status 20'),"30":__('Order_status 30')}, |
36 | formatter: Controller.api.status_formatter}, | 36 | formatter: Controller.api.status_formatter}, |
37 | {field: 'updatetime', title: __('Updatetime'), 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: 'address.name', title: __('Address.name')}, | ||
39 | - {field: 'address.Area.city', title:"发货城市"}, | ||
40 | {field: 'operate', title: __('Operate'), table: table, buttons: [ | 38 | {field: 'operate', title: __('Operate'), table: table, buttons: [ |
41 | {name: 'send', text: __('view'), icon: 'fa fa-eye', classname: 'btn btn-xs btn-warning btn-dialog chakan', url: 'litestoreorder/detail'}, | 39 | {name: 'send', text: __('view'), icon: 'fa fa-eye', classname: 'btn btn-xs btn-warning btn-dialog chakan', url: 'litestoreorder/detail'}, |
42 | ], events: Table.api.events.operate, formatter: Table.api.formatter.operate} | 40 | ], events: Table.api.events.operate, formatter: Table.api.formatter.operate} |
public/assets/js/backend/store/store.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: 'store/store/index' + location.search, | ||
9 | + // add_url: 'store/store/add', | ||
10 | + // edit_url: 'store/store/edit', | ||
11 | + del_url: 'store/store/del', | ||
12 | + // multi_url: 'store/store/multi', | ||
13 | + examine_url: 'store/store/examine', | ||
14 | + table: 'store', | ||
15 | + } | ||
16 | + }); | ||
17 | + | ||
18 | + var table = $("#table"); | ||
19 | + | ||
20 | + // 初始化表格 | ||
21 | + table.bootstrapTable({ | ||
22 | + url: $.fn.bootstrapTable.defaults.extend.index_url, | ||
23 | + pk: 'id', | ||
24 | + sortName: 'id', | ||
25 | + columns: [ | ||
26 | + [ | ||
27 | + {checkbox: true}, | ||
28 | + {field: 'id', title: __('Id')}, | ||
29 | + {field: 'order_sn', title: __('Order_sn')}, | ||
30 | + {field: 'house_ids', title: __('House_ids')}, | ||
31 | + {field: 'user.nickname', title: __('User.nickname')}, | ||
32 | + {field: 'store_name', title: __('Store_name')}, | ||
33 | + {field: 'industry.name', title: __('Industry.name')}, | ||
34 | + {field: 'name', title: __('Name')}, | ||
35 | + {field: 'mobile', title: __('Mobile')}, | ||
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}, | ||
38 | + {field: 'pay_time', title: __('Pay_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
39 | + // {field: 'province', title: __('Province')}, | ||
40 | + // {field: 'city', title: __('City')}, | ||
41 | + // {field: 'region', title: __('Region')}, | ||
42 | + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
43 | + // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
44 | + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, | ||
45 | + buttons: [ | ||
46 | + { | ||
47 | + name: 'examine', | ||
48 | + text: '审核', | ||
49 | + title: '审核', | ||
50 | + classname: 'btn btn-xs btn-primary btn-dialog', | ||
51 | + icon: 'fa fa-edit', | ||
52 | + url: $.fn.bootstrapTable.defaults.extend.examine_url, | ||
53 | + visible:function (row) { | ||
54 | + if(row.status == 1){ | ||
55 | + return true; | ||
56 | + }else{ | ||
57 | + return false; | ||
58 | + } | ||
59 | + }, | ||
60 | + } | ||
61 | + ], formatter: Table.api.formatter.operate} | ||
62 | + ] | ||
63 | + ] | ||
64 | + }); | ||
65 | + | ||
66 | + // 为表格绑定事件 | ||
67 | + Table.api.bindevent(table); | ||
68 | + }, | ||
69 | + examine: function () { | ||
70 | + Controller.api.change(); | ||
71 | + Controller.api.bindevent(); | ||
72 | + }, | ||
73 | + api: { | ||
74 | + bindevent: function () { | ||
75 | + Form.api.bindevent($("form[role=form]")); | ||
76 | + }, | ||
77 | + change: function () { | ||
78 | + $('input[name="row[status]"]').change(function () { | ||
79 | + var value = $(this).val(); | ||
80 | + console.log(value); | ||
81 | + }); | ||
82 | + } | ||
83 | + } | ||
84 | + }; | ||
85 | + return Controller; | ||
86 | +}); |
-
请 注册 或 登录 后发表评论