作者 刘朕
1 个管道 的构建 通过 耗费 0 秒

合并分支 'liuzhen' 到 'master'

Liuzhen



查看合并请求 !46
@@ -141,13 +141,13 @@ class UserWithdraw extends Backend @@ -141,13 +141,13 @@ class UserWithdraw extends Backend
141 // 余额变动记录 141 // 余额变动记录
142 $log = [ 142 $log = [
143 'user_id' => $row->user_id, 143 'user_id' => $row->user_id,
144 - 'money' => $row->money, 144 + 'score' => $row->money,
145 'before' => $user['money'], 145 'before' => $user['money'],
146 'after' => $user['money'] - $row->money, 146 'after' => $user['money'] - $row->money,
147 'createtime' => time(), 147 'createtime' => time(),
148 'memo' => '用户微信提现' 148 'memo' => '用户微信提现'
149 ]; 149 ];
150 - $result_log = Db::name('user_money_log')->insertGetId($log); 150 + $result_log = Db::name('user_score_log')->insertGetId($log);
151 $row->success_time = time(); 151 $row->success_time = time();
152 $row->more = json_encode($result_pay, JSON_UNESCAPED_UNICODE); 152 $row->more = json_encode($result_pay, JSON_UNESCAPED_UNICODE);
153 } else { 153 } else {
@@ -155,9 +155,19 @@ class UserWithdraw extends Backend @@ -155,9 +155,19 @@ class UserWithdraw extends Backend
155 $this->error($result_pay['err_code_des']); 155 $this->error($result_pay['err_code_des']);
156 } 156 }
157 } else { 157 } else {
  158 + // 余额变动记录
  159 + $log = [
  160 + 'user_id' => $row->user_id,
  161 + 'score' => $row->money,
  162 + 'before' => $user['score'],
  163 + 'after' => $user['score'] + $row->money,
  164 + 'createtime' => time(),
  165 + 'memo' => '提现审核失败'
  166 + ];
  167 + $result_log = Db::name('user_score_log')->insertGetId($log);
158 // 返还用户余额 168 // 返还用户余额
159 - $result_user = $user_model->where('id', $user['id'])->setInc('money', $row->money);  
160 - if (!$result_user) { 169 + $result_user = $user_model->where('id', $user['id'])->setInc('score', $row->money);
  170 + if (!$result_log || !$result_user) {
161 Db::rollback(); 171 Db::rollback();
162 $this->error('提现审核失败'); 172 $this->error('提现审核失败');
163 } 173 }
@@ -21,6 +21,7 @@ return [ @@ -21,6 +21,7 @@ return [
21 'City' => '市', 21 'City' => '市',
22 'Region' => '区', 22 'Region' => '区',
23 'Images' => '宣传图', 23 'Images' => '宣传图',
  24 + 'Content' => '店铺详情',
24 'Createtime' => '生成时间', 25 'Createtime' => '生成时间',
25 'Updatetime' => '更新时间', 26 'Updatetime' => '更新时间',
26 'Admin.nickname' => '昵称', 27 'Admin.nickname' => '昵称',
1 <form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> 1 <form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
2 2
3 <div class="form-group"> 3 <div class="form-group">
4 - <label class="control-label col-xs-12 col-sm-2">{:__('Order_sn')}:</label> 4 + <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
5 <div class="col-xs-12 col-sm-8"> 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> 6 + <textarea name="row[content]" id="" class="form-control editor" cols="30" rows="10">{$row.content|htmlentities}</textarea>
111 </div> 7 </div>
112 </div> 8 </div>
113 <div class="form-group layer-footer"> 9 <div class="form-group layer-footer">
@@ -97,6 +97,7 @@ class Goods extends Api @@ -97,6 +97,7 @@ class Goods extends Api
97 * @ApiMethod (POST) 97 * @ApiMethod (POST)
98 * @ApiRoute (/api/goods/goods_list) 98 * @ApiRoute (/api/goods/goods_list)
99 * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") 99 * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
  100 + * @ApiParams (name="store_id", type="integer", required=false, description="店铺id")
100 * @ApiParams (name="keyword", type="string", required=false, description="关键词") 101 * @ApiParams (name="keyword", type="string", required=false, description="关键词")
101 * @ApiParams (name="page", type="integer", required=true, description="页数") 102 * @ApiParams (name="page", type="integer", required=true, description="页数")
102 * @ApiReturnParams (name="code", type="integer", required=true, sample="0") 103 * @ApiReturnParams (name="code", type="integer", required=true, sample="0")
@@ -141,6 +142,9 @@ class Goods extends Api @@ -141,6 +142,9 @@ class Goods extends Api
141 if(!empty($param['keyword'])) { 142 if(!empty($param['keyword'])) {
142 $basic_where['goods_name'] = ['like','%'.$param['keyword'].'%']; 143 $basic_where['goods_name'] = ['like','%'.$param['keyword'].'%'];
143 } 144 }
  145 + if(!empty($param['store_id'])) {
  146 + $basic_where['store_id'] = $param['store_id'];
  147 + }
144 $where = [ 148 $where = [
145 'where' => $basic_where, 149 'where' => $basic_where,
146 ]; 150 ];
@@ -9,7 +9,10 @@ use app\api\model\Industry; @@ -9,7 +9,10 @@ use app\api\model\Industry;
9 use app\api\model\StoreComment; 9 use app\api\model\StoreComment;
10 use app\api\model\StoreInform; 10 use app\api\model\StoreInform;
11 use app\api\model\StoreInformGood; 11 use app\api\model\StoreInformGood;
  12 +use app\api\model\StoreInformLog;
  13 +use app\api\model\StoreInformView;
12 use app\api\model\UserHouse; 14 use app\api\model\UserHouse;
  15 +use app\api\model\UserMoneyLog;
13 use app\api\validate\HotValidate; 16 use app\api\validate\HotValidate;
14 use app\common\controller\Api; 17 use app\common\controller\Api;
15 use think\Db; 18 use think\Db;
@@ -32,7 +35,6 @@ class Hot extends Api @@ -32,7 +35,6 @@ class Hot extends Api
32 protected $favorite_model; 35 protected $favorite_model;
33 protected $comment_model; 36 protected $comment_model;
34 protected $good_model; 37 protected $good_model;
35 - protected $follow_model;  
36 protected $user_id; 38 protected $user_id;
37 39
38 public function __construct(Request $request,\app\api\model\Store $store,Industry $industry,StoreInform $store_inform,UserHouse $user_house,StoreInformGood $store_inform_good) 40 public function __construct(Request $request,\app\api\model\Store $store,Industry $industry,StoreInform $store_inform,UserHouse $user_house,StoreInformGood $store_inform_good)
@@ -55,6 +57,7 @@ class Hot extends Api @@ -55,6 +57,7 @@ class Hot extends Api
55 * @ApiMethod (POST) 57 * @ApiMethod (POST)
56 * @ApiRoute (/api/hot/store_list) 58 * @ApiRoute (/api/hot/store_list)
57 * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") 59 * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
  60 + * @ApiParams (name="store_id", type="integer", required=false, description="店铺id")
58 * @ApiParams (name="page", type="integer", required=true, description="页数") 61 * @ApiParams (name="page", type="integer", required=true, description="页数")
59 * @ApiReturnParams (name="code", type="integer", required=true, sample="0") 62 * @ApiReturnParams (name="code", type="integer", required=true, sample="0")
60 * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") 63 * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
@@ -100,8 +103,12 @@ class Hot extends Api @@ -100,8 +103,12 @@ class Hot extends Api
100 { 103 {
101 if($this->request->isPost()){ 104 if($this->request->isPost()){
102 $page = $this->request->param('page',1,'intval'); 105 $page = $this->request->param('page',1,'intval');
  106 + $this->store_id = $this->request->param('store_id',0,'intval');
103 $house_ids = $this->user_house_model->where('user_id',$this->user_id)->column('house_id'); 107 $house_ids = $this->user_house_model->where('user_id',$this->user_id)->column('house_id');
104 $query = function ($query) use ($house_ids){ 108 $query = function ($query) use ($house_ids){
  109 + if($this->store_id) {
  110 + $query->where('store_id',$this->store_id);
  111 + }
105 foreach ($house_ids as $k=>$v){ 112 foreach ($house_ids as $k=>$v){
106 $w = ['house_ids'=>['like','%,'.$v.',%']]; 113 $w = ['house_ids'=>['like','%,'.$v.',%']];
107 if($k == 0) { 114 if($k == 0) {
@@ -118,6 +125,7 @@ class Hot extends Api @@ -118,6 +125,7 @@ class Hot extends Api
118 $order = ['number'=>'DESC','createtime'=>'DESC']; 125 $order = ['number'=>'DESC','createtime'=>'DESC'];
119 $inform = $this->store_inform_model->pageSelect($page,$where,'*',$order,config('option.num')); 126 $inform = $this->store_inform_model->pageSelect($page,$where,'*',$order,config('option.num'));
120 $list = $inform->items(); 127 $list = $inform->items();
  128 + $view_model = new StoreInformView();
121 foreach ($list as &$v) { 129 foreach ($list as &$v) {
122 // 获取点赞数及是否点赞 130 // 获取点赞数及是否点赞
123 $where_g = [ 131 $where_g = [
@@ -126,6 +134,24 @@ class Hot extends Api @@ -126,6 +134,24 @@ class Hot extends Api
126 $v['good_count'] = $this->store_inform_good_model->getCount($where_g); 134 $v['good_count'] = $this->store_inform_good_model->getCount($where_g);
127 $where_g['user_id'] = $this->user_id; 135 $where_g['user_id'] = $this->user_id;
128 $v['is_good'] = $this->store_inform_good_model->getCount($where_g); 136 $v['is_good'] = $this->store_inform_good_model->getCount($where_g);
  137 + // 记录浏览量
  138 + $where_v = [
  139 + 'user_id' => $this->auth->id,
  140 + 'object_id' => $v['id']
  141 + ];
  142 + $view = $view_model->where($where_v)->find();
  143 + if($view) {
  144 + $where_v = [
  145 + 'id' => $view['id']
  146 + ];
  147 + $view_model->where($where_v)->setInc('count');
  148 + } else {
  149 + $insert = [
  150 + 'user_id' => $this->auth->id,
  151 + 'object_id' => $v['id']
  152 + ];
  153 + $view_model->add($insert);
  154 + }
129 } 155 }
130 $return = [ 156 $return = [
131 'list' => $list, 157 'list' => $list,
@@ -137,6 +163,185 @@ class Hot extends Api @@ -137,6 +163,185 @@ class Hot extends Api
137 } 163 }
138 164
139 /** 165 /**
  166 + * 商圈店铺主页
  167 + * @ApiWeigh (75)
  168 + *
  169 + * @ApiTitle (商圈店铺主页)
  170 + * @ApiSummary (商圈店铺主页)
  171 + * @ApiMethod (POST)
  172 + * @ApiRoute (/api/hot/store_detail)
  173 + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
  174 + * @ApiParams (name="store_id", type="integer", required=true, description="店铺id")
  175 + * @ApiReturnParams (name="code", type="integer", required=true, sample="0")
  176 + * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
  177 + * @ApiReturn ({
  178 + 'code':'1',
  179 + 'msg':'返回成功',
  180 + "data": {
  181 + "store": {
  182 + "id": 1,
  183 + "user_id": 1,
  184 + "store_name": "店铺名称",
  185 + "industry_id": "行业标签",
  186 + "name": "测试11",
  187 + "mobile": "联系电话",
  188 + "store_icon": "图标",
  189 + "province": "地址省",
  190 + "city": "市",
  191 + "region": "区",
  192 + "images": "/assets/img/qrcode.png,/assets/img/qrcode.png",
  193 + "content": "店铺详情",
  194 + "image_arr"店铺轮播: [
  195 + "http://cloud.caiyunpan.brotop.cn/assets/img/qrcode.png",
  196 + "http://cloud.caiyunpan.brotop.cn/assets/img/qrcode.png"
  197 + ]
  198 + }
  199 + }
  200 + })
  201 + */
  202 + public function store_detail()
  203 + {
  204 + if($this->request->isPost()){
  205 + $store_id = $this->request->param('store_id',0,'intval');
  206 + $where = [
  207 + 'where' => ['id'=>$store_id]
  208 + ];
  209 + $store = $this->store_model->findOrFail($where);
  210 + $return = [
  211 + 'store' => $store
  212 + ];
  213 + $this->success('请求成功',$return);
  214 + }
  215 + }
  216 +
  217 + /**
  218 + * 领取红包
  219 + * @ApiWeigh (60)
  220 + *
  221 + * @ApiTitle (领取红包)
  222 + * @ApiSummary (领取红包)
  223 + * @ApiMethod (POST)
  224 + * @ApiRoute (/api/hot/get_red_package)
  225 + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
  226 + * @ApiParams (name="store_inform_id", type="integer", required=true, description="商家信息id")
  227 + * @ApiReturnParams (name="code", type="integer", required=true, sample="0")
  228 + * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
  229 + * @ApiReturn ({
  230 + 'code':'1',
  231 + 'msg':'返回成功',
  232 + "data": {
  233 + }
  234 + })
  235 + */
  236 + public function get_red_package()
  237 + {
  238 + if($this->request->isPost()){
  239 + $param = (new HotValidate())->goCheck('get_red_package');
  240 + $where = [
  241 + 'where' => ['id'=>$param['store_inform_id']]
  242 + ];
  243 + $inform = $this->store_inform_model->findOrFail($where);
  244 + if($inform['surplus'] == 0) {
  245 + $this->error('红包已抢完');
  246 + }
  247 + $log_model = new StoreInformLog();
  248 + $user_model = new \app\api\model\User();
  249 + $money_log_model = new UserMoneyLog();
  250 + $where_l = [
  251 + 'where' => [
  252 + 'user_id' => $this->auth->id,
  253 + 'inform_id' => $inform['id'],
  254 + ]
  255 + ];
  256 + $log = $log_model->findOrFail($where_l,false);
  257 + if($log) {
  258 + $this->error('已领取过该商圈红包');
  259 + }
  260 + Db::startTrans();
  261 + // 录入领取记录
  262 + $log_data = [
  263 + 'user_id' => $this->auth->id,
  264 + 'inform_id' => $inform['id'],
  265 + 'money' => $inform['single']
  266 + ];
  267 + $res_log = $log_model->add($log_data);
  268 + // 新增用户余额
  269 + $res_user = $user_model->where('id',$this->auth->id)->setInc('money',$inform['single']);
  270 + // 新增余额记录
  271 + $money_log_data = [
  272 + 'user_id' => $this->auth->id,
  273 + 'money' => $inform['single'],
  274 + 'before' => $this->auth->money,
  275 + 'after' => bcadd($this->auth->money,$inform['single'],2),
  276 + 'memo' => '领取红包'
  277 + ];
  278 + $res_moeny_log = $money_log_model->add($money_log_data);
  279 + if(!$res_log || !$res_user || !$res_moeny_log) {
  280 + Db::rollback();
  281 + $this->error('红包领取失败');
  282 + }
  283 + Db::commit();
  284 + $this->success('领取成功');
  285 + }
  286 + }
  287 +
  288 + /**
  289 + * 留言列表
  290 + * @ApiWeigh (50)
  291 + *
  292 + * @ApiTitle (留言列表)
  293 + * @ApiSummary (留言列表)
  294 + * @ApiMethod (POST)
  295 + * @ApiRoute (/api/hot/comment_list)
  296 + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
  297 + * @ApiParams (name="store_id", type="integer", required=true, description="店铺id")
  298 + * @ApiParams (name="page", type="integer", required=true, description="页数")
  299 + * @ApiReturnParams (name="code", type="integer", required=true, sample="0")
  300 + * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
  301 + * @ApiReturn ({
  302 + 'code':'1',
  303 + 'msg':'返回成功'
  304 + })
  305 + */
  306 + public function comment_list()
  307 + {
  308 + $param = (new HotValidate())->goCheck('common');
  309 + $where = [
  310 + 'where' => ['store_id' => $param['store_id']]
  311 + ];
  312 + $model = new StoreComment();
  313 + $order = ['createtime'=>'DESC'];
  314 + $comment = $model->pageSelect($param['page'],$where,'*',$order,config('option.num'));
  315 + $list = $comment->items();
  316 + if($list) {
  317 + foreach ($list as &$v) {
  318 + $v['is_self'] = $v['type'] == 1 ? 1 : 0;
  319 + if($v['is_self'] == 1) {
  320 + $user = $this->auth->getUserinfo();
  321 + $v['nickname'] = $user['nickname'];
  322 + $v['avatar'] = $user['avatar'];
  323 + } else {
  324 + $where_s = [
  325 + 'where' => [
  326 + 'id' => $v['store_id']
  327 + ]
  328 + ];
  329 + $store = $this->store_model->findOrFail($where_s,false,'id,store_name as nickname,store_icon as avatar');
  330 + $v['nickname'] = $store['nickname'];
  331 + $v['avatar'] = cdnurl($store['avatar']);
  332 + }
  333 + }
  334 +// $list = array_sort($list,'id',SORT_ASC);
  335 + }
  336 + $return = [
  337 + 'list' => $list,
  338 + 'this_page' => $comment->currentPage(),
  339 + 'total_page' => $comment->lastPage()
  340 + ];
  341 + $this->success('成功',$return);
  342 + }
  343 +
  344 + /**
140 * 留言提交 345 * 留言提交
141 * @ApiWeigh (50) 346 * @ApiWeigh (50)
142 * 347 *
@@ -852,6 +852,7 @@ class Store extends Api @@ -852,6 +852,7 @@ class Store extends Api
852 if (!$validate->check($param)) { 852 if (!$validate->check($param)) {
853 $this->error($validate->getError()); 853 $this->error($validate->getError());
854 } 854 }
  855 + $withdraw_percent = config('site.withdraw_percent');
855 if ($param['money'] < 1) { 856 if ($param['money'] < 1) {
856 $this->error('提现金额不可小于1元'); 857 $this->error('提现金额不可小于1元');
857 } 858 }
@@ -859,8 +860,8 @@ class Store extends Api @@ -859,8 +860,8 @@ class Store extends Api
859 $this->error('提现金额不可大于1000元'); 860 $this->error('提现金额不可大于1000元');
860 } 861 }
861 // 判断余额是否充足 862 // 判断余额是否充足
862 - if ($param['money'] > $this->auth->money) {  
863 - $this->error('桃币余额不足,无法提现'); 863 + if ($param['money'] * $withdraw_percent > $this->auth->money) {
  864 + $this->error('余额不足,无法提现');
864 } 865 }
865 // 提现记录 866 // 提现记录
866 Db::startTrans(); 867 Db::startTrans();
@@ -870,24 +871,24 @@ class Store extends Api @@ -870,24 +871,24 @@ class Store extends Api
870 $order_sn = date('YmdHis').rand(0000,9999); 871 $order_sn = date('YmdHis').rand(0000,9999);
871 $withdraw = [ 872 $withdraw = [
872 'user_id' => $this->auth->id, 873 'user_id' => $this->auth->id,
873 - 'before_money' => $this->auth->money,  
874 - 'after_money' => $this->auth->money - $param['money'], 874 + 'before_money' => $this->auth->score,
  875 + 'after_money' => $this->auth->score - $param['money'] * $withdraw_percent,
875 'order_sn' => $order_sn, 876 'order_sn' => $order_sn,
876 'money' => $param['money'], 877 'money' => $param['money'],
877 ]; 878 ];
878 $result = $withdraw_model->isUpdate(false)->save($withdraw); 879 $result = $withdraw_model->isUpdate(false)->save($withdraw);
879 // 记录用户余额 880 // 记录用户余额
880 - $result_user = $user_model->isUpdate(true)->save(['money' => $user['money'] - $param['money']]); 881 + $result_user = $user_model->isUpdate(true)->save(['money' => $user['money'] - $param['money'] * $withdraw_percent]);
881 // 记录余额变更 882 // 记录余额变更
882 $insert_data = array( 883 $insert_data = array(
883 'user_id' => $this->auth->id, 884 'user_id' => $this->auth->id,
884 - 'money' => $param['money'],  
885 - 'before' => $this->auth->money,  
886 - 'after' => $this->auth->money - $param['money'], 885 + 'score' => $param['money'],
  886 + 'before' => $this->auth->score,
  887 + 'after' => $this->auth->score - $param['money'] * $withdraw_percent,
887 'createtime' => time(), 888 'createtime' => time(),
888 'memo' => '提现', 889 'memo' => '提现',
889 ); 890 );
890 - $res_log = Db::name('user_money_log')->insert($insert_data); 891 + $res_log = Db::name('user_score_log')->insert($insert_data);
891 if (!$result || !$result_user || !$res_log) { 892 if (!$result || !$result_user || !$res_log) {
892 Db::rollback(); 893 Db::rollback();
893 $this->error('提现申请失败', [$result, $result_user]); 894 $this->error('提现申请失败', [$result, $result_user]);
@@ -19,7 +19,7 @@ class Store extends Base @@ -19,7 +19,7 @@ class Store extends Base
19 public function getImageArrAttr($value,$data) 19 public function getImageArrAttr($value,$data)
20 { 20 {
21 $arr = []; 21 $arr = [];
22 - if($data['images']) { 22 + if(!empty($data['images'])) {
23 $arr = explode(',',$data['images']); 23 $arr = explode(',',$data['images']);
24 foreach ($arr as &$v) { 24 foreach ($arr as &$v) {
25 $v = cdnurl($v); 25 $v = cdnurl($v);
  1 +<?php
  2 +
  3 +
  4 +namespace app\api\model;
  5 +
  6 +
  7 +class StoreInformLog extends Base
  8 +{
  9 +
  10 +}
  1 +<?php
  2 +
  3 +
  4 +namespace app\api\model;
  5 +
  6 +
  7 +class StoreInformView extends Base
  8 +{
  9 +
  10 +}
@@ -37,5 +37,7 @@ class HotValidate extends BaseValidate @@ -37,5 +37,7 @@ class HotValidate extends BaseValidate
37 'red' => ['red_package','number'], // 发布信息红包 37 'red' => ['red_package','number'], // 发布信息红包
38 'house_new' => ['house_ids'], // 绑定社区 38 'house_new' => ['house_ids'], // 绑定社区
39 'deposit_order' => ['deposit_id'], // 板币充值提交 39 'deposit_order' => ['deposit_id'], // 板币充值提交
  40 + 'comment_list' => ['store_id','page'], // 留言列表
  41 + 'get_red_package' => ['store_inform_id'], // 商家信息id
40 ]; 42 ];
41 } 43 }
@@ -371,4 +371,31 @@ if(!function_exists('get_order_sn')) { @@ -371,4 +371,31 @@ if(!function_exists('get_order_sn')) {
371 $micro = explode('.',explode(' ',microtime())[0])[1]; 371 $micro = explode('.',explode(' ',microtime())[0])[1];
372 return date('YmdHis').substr($micro,0,5).rand(0,9); 372 return date('YmdHis').substr($micro,0,5).rand(0,9);
373 } 373 }
  374 +}
  375 +
  376 +if(!function_exists('array_sort')) {
  377 + /**
  378 + * 二维数组排序
  379 + * @param $array
  380 + * @param $field
  381 + * @param $sort
  382 + */
  383 + function array_sort($array,$field,$sort = 'SORT_DESC')
  384 + {
  385 + // 数组排序
  386 + $sort = array(
  387 + 'direction' => $sort, //排序顺序标志 SORT_DESC 降序;SORT_ASC 升序
  388 + 'field' => $field, //排序字段
  389 + );
  390 + $arrSort = array();
  391 + foreach ($array AS $uniqid => $row) {
  392 + foreach ($row AS $key => $value) {
  393 + $arrSort[$key][$uniqid] = $value;
  394 + }
  395 + }
  396 + if ($sort['direction']) {
  397 + array_multisort($arrSort[$sort['field']], $sort['direction'], $array);
  398 + }
  399 + return $array;
  400 + }
374 } 401 }
@@ -41,10 +41,10 @@ class User extends Model @@ -41,10 +41,10 @@ class User extends Model
41 { 41 {
42 if (!$value) { 42 if (!$value) {
43 //如果不需要启用首字母头像,请使用 43 //如果不需要启用首字母头像,请使用
44 - //$value = '/assets/img/avatar.png';  
45 - $value = letter_avatar($data['nickname']); 44 + $value = '/assets/img/avatar.png';
  45 +// $value = letter_avatar($data['nickname']);
46 } 46 }
47 - return $value; 47 + return cdnurl($value);
48 } 48 }
49 49
50 /** 50 /**
此 diff 太大无法显示。
@@ -7,7 +7,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -7,7 +7,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
7 extend: { 7 extend: {
8 index_url: 'store/store/index' + location.search, 8 index_url: 'store/store/index' + location.search,
9 // add_url: 'store/store/add', 9 // add_url: 'store/store/add',
10 - // edit_url: 'store/store/edit', 10 + edit_url: 'store/store/edit',
11 del_url: 'store/store/del', 11 del_url: 'store/store/del',
12 // multi_url: 'store/store/multi', 12 // multi_url: 'store/store/multi',
13 examine_url: 'store/store/examine', 13 examine_url: 'store/store/examine',
@@ -44,6 +44,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -44,6 +44,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
44 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, 44 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
45 buttons: [ 45 buttons: [
46 { 46 {
  47 + name: 'edit',
  48 + text: '',
  49 + title: '编辑',
  50 + classname: 'btn btn-xs btn-success btn-editone',
  51 + icon: 'fa fa-edit',
  52 + url: $.fn.bootstrapTable.defaults.extend.edit_url,
  53 + visible:function (row) {
  54 + if(row.status == 3){
  55 + return true;
  56 + }else{
  57 + return false;
  58 + }
  59 + },
  60 + },
  61 + {
47 name: 'examine', 62 name: 'examine',
48 text: '审核', 63 text: '审核',
49 title: '审核', 64 title: '审核',
@@ -66,6 +81,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -66,6 +81,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
66 // 为表格绑定事件 81 // 为表格绑定事件
67 Table.api.bindevent(table); 82 Table.api.bindevent(table);
68 }, 83 },
  84 + edit: function () {
  85 + Controller.api.bindevent();
  86 + },
69 examine: function () { 87 examine: function () {
70 Controller.api.change(); 88 Controller.api.change();
71 Controller.api.bindevent(); 89 Controller.api.bindevent();