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

合并分支 'liuzhen' 到 'master'

商圈接口调试



查看合并请求 !81
@@ -383,6 +383,7 @@ class Hot extends Api @@ -383,6 +383,7 @@ class Hot extends Api
383 'user_id' => $this->auth->id, 383 'user_id' => $this->auth->id,
384 'object_id' => $store['id'], 384 'object_id' => $store['id'],
385 'object_user_id' => $store['user_id'], 385 'object_user_id' => $store['user_id'],
  386 + 'type' => 2
386 ]; 387 ];
387 $msg = $msg_model->where($where_m)->find(); 388 $msg = $msg_model->where($where_m)->find();
388 if($msg) { 389 if($msg) {
@@ -304,23 +304,7 @@ class House extends Api @@ -304,23 +304,7 @@ class House extends Api
304 ->order('createtime desc') 304 ->order('createtime desc')
305 ->select(); 305 ->select();
306 306
307 - if($type == 1) {  
308 - //查出该用户已绑定的和申请中的小区  
309 - $user_house = Db::name('user_house')  
310 - ->where('user_id',$user_id)  
311 - ->select();  
312 -  
313 - foreach ($data as &$v){  
314 - $v['shen_status'] = 0;  
315 - foreach ($user_house as &$val){  
316 - if($v['id'] == $val['house_id']){  
317 - $v['shen_status'] = $val['status'];  
318 - }else{  
319 - $v['shen_status'] = 0;  
320 - }  
321 - }  
322 - }  
323 - } else { 307 + if($type == 2) {
324 //查出该用户入驻商家已绑定的和申请中的小区 308 //查出该用户入驻商家已绑定的和申请中的小区
325 $store_model = new \app\api\model\Store(); 309 $store_model = new \app\api\model\Store();
326 $where_s = ['user_id'=>$this->auth->id]; 310 $where_s = ['user_id'=>$this->auth->id];
@@ -337,6 +321,22 @@ class House extends Api @@ -337,6 +321,22 @@ class House extends Api
337 $v['shen_status'] = 0; 321 $v['shen_status'] = 0;
338 } 322 }
339 } 323 }
  324 + } else {
  325 + //查出该用户已绑定的和申请中的小区
  326 + $user_house = Db::name('user_house')
  327 + ->where('user_id',$user_id)
  328 + ->select();
  329 +
  330 + foreach ($data as &$v){
  331 + $v['shen_status'] = 0;
  332 + foreach ($user_house as &$val){
  333 + if($v['id'] == $val['house_id']){
  334 + $v['shen_status'] = $val['status'];
  335 + }else{
  336 + $v['shen_status'] = 0;
  337 + }
  338 + }
  339 + }
340 } 340 }
341 $this->success('success',$data); 341 $this->success('success',$data);
342 } 342 }
@@ -1017,10 +1017,23 @@ class Store extends Api @@ -1017,10 +1017,23 @@ class Store extends Api
1017 "list": [ 1017 "list": [
1018 { 1018 {
1019 "id": 1, 1019 "id": 1,
1020 - "name": "行业名称",  
1021 - "weigh": 0, 1020 + "user_id": 1,
  1021 + "object_id": 1,
  1022 + "object_user_id": 1,
  1023 + "type": 1,
  1024 + "content": "123132132",
  1025 + "image": "",
  1026 + "is_read_object": 是否已读1=是2=否,
  1027 + "createtime": "2020-08-30 09:37:47",
  1028 + "updatetime": 1598754989,
  1029 + "user_info": {
  1030 + "id": 1,
  1031 + "username": "admin"
  1032 + }
1022 } 1033 }
1023 - ] 1034 + ],
  1035 + "this_page": 当前页数,
  1036 + "total_page": 总页数
1024 } 1037 }
1025 }) 1038 })
1026 */ 1039 */
@@ -1031,7 +1044,7 @@ class Store extends Api @@ -1031,7 +1044,7 @@ class Store extends Api
1031 $store = $this->get_store(); 1044 $store = $this->get_store();
1032 $page = $param['page']; 1045 $page = $param['page'];
1033 $where = [ 1046 $where = [
1034 - 'where' => ['object_id'=>$store['id'],'object_user_id'=>$this->auth->id], 1047 + 'where' => ['object_id'=>$store['id'],'object_user_id'=>$this->auth->id,'type'=>2],
1035 'with' => ['user_info'] 1048 'with' => ['user_info']
1036 ]; 1049 ];
1037 $order = ['createtime'=>'DESC']; 1050 $order = ['createtime'=>'DESC'];
@@ -1064,13 +1077,41 @@ class Store extends Api @@ -1064,13 +1077,41 @@ class Store extends Api
1064 'code':'1', 1077 'code':'1',
1065 'msg':'返回成功', 1078 'msg':'返回成功',
1066 "data": { 1079 "data": {
1067 - "comment": [  
1068 - {  
1069 - "id": 1,  
1070 - "name": "行业名称",  
1071 - "weigh": 0,  
1072 - }  
1073 - ] 1080 + "list": [
  1081 + {
  1082 + "id": 2,
  1083 + "user_id": 1,
  1084 + "store_id": 1,
  1085 + "store_user_id": 1,
  1086 + "type": 2,
  1087 + "content": "消息文字内容",
  1088 + "image": "消息图片",
  1089 + "createtime": "2020-08-28 14:09:50",
  1090 + "user": {
  1091 + "id": 1,
  1092 + "nickname": "发送人昵称",
  1093 + "avatar": "头像",
  1094 + "image_arr": []
  1095 + }
  1096 + },
  1097 + {
  1098 + "id": 1,
  1099 + "user_id": 1,
  1100 + "store_id": 1,
  1101 + "store_user_id": 1,
  1102 + "type": 1,
  1103 + "content": "消息文字内容",
  1104 + "image": "消息图片",
  1105 + "createtime": "2020-08-28 13:36:30",
  1106 + "user": {
  1107 + "id": 1,
  1108 + "nickname": "发送人昵称",
  1109 + "avatar": "头像",
  1110 + }
  1111 + }
  1112 + ],
  1113 + "this_page": 当前页数,
  1114 + "total_page": 总页数
1074 } 1115 }
1075 }) 1116 })
1076 */ 1117 */
@@ -1104,7 +1145,7 @@ class Store extends Api @@ -1104,7 +1145,7 @@ class Store extends Api
1104 $user = $user_model->field('id,nickname,avatar')->where('id',$v['user_id'])->find(); 1145 $user = $user_model->field('id,nickname,avatar')->where('id',$v['user_id'])->find();
1105 $user['avatar'] = cdnurl($user['avatar']); 1146 $user['avatar'] = cdnurl($user['avatar']);
1106 } else { 1147 } else {
1107 - $user = $this->store_model->field('id,store_name as nickname,store_icon as avatar')->where('id',$v['house_user_id'])->find(); 1148 + $user = $this->store_model->field('id,store_name as nickname,store_icon as avatar')->where('id',$v['store_id'])->find();
1108 $user['avatar'] = cdnurl($user['avatar']); 1149 $user['avatar'] = cdnurl($user['avatar']);
1109 } 1150 }
1110 $v['user'] = $user; 1151 $v['user'] = $user;
@@ -1207,6 +1248,7 @@ class Store extends Api @@ -1207,6 +1248,7 @@ class Store extends Api
1207 'code':'1', 1248 'code':'1',
1208 'msg':'返回成功', 1249 'msg':'返回成功',
1209 "data": { 1250 "data": {
  1251 + "score": 板币余额,
1210 "list": [ 1252 "list": [
1211 { 1253 {
1212 "id": 1, 1254 "id": 1,
@@ -1226,6 +1268,7 @@ class Store extends Api @@ -1226,6 +1268,7 @@ class Store extends Api
1226 ]; 1268 ];
1227 $deposit = $this->deposit_model->selectOrFail($where,false,'*','weigh'); 1269 $deposit = $this->deposit_model->selectOrFail($where,false,'*','weigh');
1228 $return = [ 1270 $return = [
  1271 + 'score' => $this->auth->score,
1229 'list' => $deposit, 1272 'list' => $deposit,
1230 ]; 1273 ];
1231 $this->success('请求成功',$return); 1274 $this->success('请求成功',$return);
@@ -1320,11 +1363,18 @@ class Store extends Api @@ -1320,11 +1363,18 @@ class Store extends Api
1320 "data": { 1363 "data": {
1321 "list": [ 1364 "list": [
1322 { 1365 {
1323 - "id": 1,  
1324 - "name": "行业名称",  
1325 - "weigh": 0, 1366 + "id": 3,
  1367 + "user_id": 1,
  1368 + "score": 5800,
  1369 + "before": 10000,
  1370 + "after": 4200,
  1371 + "memo": "发布信息",
  1372 + "status": 为0不显示(1=审核中,2=审核通过,3=审核失败),
  1373 + "createtime": "2020-08-30 10:17:05",
1326 } 1374 }
1327 - ] 1375 + ],
  1376 + "this_page": 当前页数,
  1377 + "total_page": 总页数
1328 } 1378 }
1329 }) 1379 })
1330 */ 1380 */
@@ -1335,8 +1385,7 @@ class Store extends Api @@ -1335,8 +1385,7 @@ class Store extends Api
1335 $store = $this->get_store(); 1385 $store = $this->get_store();
1336 $page = $param['page']; 1386 $page = $param['page'];
1337 $where = [ 1387 $where = [
1338 - 'where' => ['store_id'=>$store['id']],  
1339 - 'with' => ['user_info'] 1388 + 'where' => ['user_id'=>$this->auth->id],
1340 ]; 1389 ];
1341 $order = ['createtime'=>'DESC']; 1390 $order = ['createtime'=>'DESC'];
1342 $model = new UserScoreLog(); 1391 $model = new UserScoreLog();
@@ -6,5 +6,9 @@ namespace app\api\model; @@ -6,5 +6,9 @@ namespace app\api\model;
6 6
7 class Message extends Base 7 class Message extends Base
8 { 8 {
9 - 9 +
  10 + public function getCreatetimeAttr($value)
  11 + {
  12 + return date('Y-m-d H:i:s',$value);
  13 + }
10 } 14 }
@@ -4,4 +4,19 @@ namespace app\api\model; @@ -4,4 +4,19 @@ namespace app\api\model;
4 4
5 class User extends Base{ 5 class User extends Base{
6 6
  7 + /**
  8 + * 获取头像
  9 + * @param string $value
  10 + * @param array $data
  11 + * @return string
  12 + */
  13 + public function getAvatarAttr($value, $data)
  14 + {
  15 + if (!$value) {
  16 + //如果不需要启用首字母头像,请使用
  17 + $value = '/assets/img/avatar.png';
  18 +// $value = letter_avatar($data['nickname']);
  19 + }
  20 + return cdnurl($value);
  21 + }
7 } 22 }
@@ -4,4 +4,8 @@ namespace app\api\model; @@ -4,4 +4,8 @@ namespace app\api\model;
4 4
5 class UserScoreLog extends Base{ 5 class UserScoreLog extends Base{
6 6
  7 + public function getCreatetimeAttr($value)
  8 + {
  9 + return date('Y-m-d H:i:s',$value);
  10 + }
7 } 11 }