作者 Cool
1 个管道 的构建 通过 耗费 1 秒

Merge branch 'master' of http://114.215.101.231:8099/guosheng/community into Branch_liuzhen

@@ -26,7 +26,7 @@ use think\Request; @@ -26,7 +26,7 @@ use think\Request;
26 */ 26 */
27 class Hot extends Api 27 class Hot extends Api
28 { 28 {
29 - protected $noNeedLogin = []; 29 + protected $noNeedLogin = ['banner'];
30 protected $noNeedRight = ['*']; 30 protected $noNeedRight = ['*'];
31 protected $store_model; 31 protected $store_model;
32 protected $store_inform_model; 32 protected $store_inform_model;
@@ -51,6 +51,39 @@ class Hot extends Api @@ -51,6 +51,39 @@ class Hot extends Api
51 51
52 /** 52 /**
53 * 商圈信息列表 53 * 商圈信息列表
  54 + * @ApiWeigh (90)
  55 + * @ApiTitle (首页轮播图)
  56 + * @ApiSummary (首页轮播图)
  57 + * @ApiMethod (POST)
  58 + * @ApiRoute (/api/hot/banner)
  59 + *
  60 + * @ApiReturn({
  61 + "code": 1,
  62 + "msg": "success",
  63 + "time": "1600064624",
  64 + "data": [{
  65 + "id": 1,
  66 + "image": "http://community.qiniu.brotop.cn/uploads/20200910/0afb1f6a54b2ca30a2fa3f3f6cafbd3f.jpg",
  67 + "weigh": 1,
  68 + "createtime": "2020-09-10 11:47:28"
  69 + }]
  70 + })
  71 + */
  72 + public function banner()
  73 + {
  74 + $data = Db::name('store_banner')
  75 + ->field('updatetime',true)
  76 + ->order(['weigh'=>'desc','createtime'=>'asc'])
  77 + ->select();
  78 + foreach ($data as &$v){
  79 + $v['image'] = cdnurl($v['image'],true);
  80 + $v['createtime'] = date('Y-m-d H:i:s',$v['createtime']);
  81 + }
  82 + $this->success('success',$data);
  83 + }
  84 +
  85 + /**
  86 + * 商圈信息列表
54 * @ApiWeigh (80) 87 * @ApiWeigh (80)
55 * 88 *
56 * @ApiTitle (商圈信息列表) 89 * @ApiTitle (商圈信息列表)
@@ -13,6 +13,8 @@ use app\common\controller\Api; @@ -13,6 +13,8 @@ use app\common\controller\Api;
13 use think\Cache; 13 use think\Cache;
14 use think\Db; 14 use think\Db;
15 use think\Validate; 15 use think\Validate;
  16 +use think\Exception;
  17 +use think\exception\PDOException;
16 use app\api\model\House; 18 use app\api\model\House;
17 use app\api\model\HouseAdmin as HouseAdminModel; 19 use app\api\model\HouseAdmin as HouseAdminModel;
18 use app\api\model\HouseBoard; 20 use app\api\model\HouseBoard;
@@ -255,7 +257,7 @@ class HouseAdmin extends Api @@ -255,7 +257,7 @@ class HouseAdmin extends Api
255 $where = ['hb.house_id'=>$house_id]; 257 $where = ['hb.house_id'=>$house_id];
256 $total_num = HouseBoard::where($where) 258 $total_num = HouseBoard::where($where)
257 ->alias('hb') 259 ->alias('hb')
258 - ->join('house_admin ha','ha.user_id = hb.admin_user_id') 260 + ->join('house_admin ha','ha.id = hb.admin_user_id')
259 ->count(); 261 ->count();
260 $list = $this->getBoardList($where,$page,$pageNum); 262 $list = $this->getBoardList($where,$page,$pageNum);
261 $this->success('success',compact('total_num','list')); 263 $this->success('success',compact('total_num','list'));
@@ -418,7 +420,7 @@ class HouseAdmin extends Api @@ -418,7 +420,7 @@ class HouseAdmin extends Api
418 Db::startTrans(); 420 Db::startTrans();
419 try{ 421 try{
420 (new HouseBoard)->allowField(true)->save(array_merge([ 422 (new HouseBoard)->allowField(true)->save(array_merge([
421 - 'admin_user_id' => $this->auth->id 423 + 'admin_user_id' => $admin['id']
422 ],$post)); 424 ],$post));
423 // 该社区下的业主ID 425 // 该社区下的业主ID
424 $user_id_arr = UserHouse::where('house_id',$post['house_id']) 426 $user_id_arr = UserHouse::where('house_id',$post['house_id'])
@@ -255,6 +255,10 @@ class HouseBoard extends Api @@ -255,6 +255,10 @@ class HouseBoard extends Api
255 } 255 }
256 256
257 } 257 }
  258 + // 因为公告首页接口已经返回了最新的公告,所以这里防止重复就去掉最新的
  259 + if(empty($page) || $page == 1){
  260 + array_shift($data['info']);
  261 + }
258 $this->success('success',$data); 262 $this->success('success',$data);
259 } 263 }
260 264
@@ -396,6 +400,7 @@ class HouseBoard extends Api @@ -396,6 +400,7 @@ class HouseBoard extends Api
396 'is_read_user' => 1 400 'is_read_user' => 1
397 ]; 401 ];
398 $res_msg = $msg_model->edit($update); 402 $res_msg = $msg_model->edit($update);
  403 + $message_id = $msg['id'];
399 } else { 404 } else {
400 $insert = $where_m; 405 $insert = $where_m;
401 $insert['type'] = 3; 406 $insert['type'] = 3;
@@ -403,6 +408,7 @@ class HouseBoard extends Api @@ -403,6 +408,7 @@ class HouseBoard extends Api
403 $insert['image'] = $param['image']; 408 $insert['image'] = $param['image'];
404 $insert['is_read_user'] = 2; 409 $insert['is_read_user'] = 2;
405 $res_msg = $msg_model->add($insert); 410 $res_msg = $msg_model->add($insert);
  411 + $message_id = $msg_model->where($where_m)->value('id');
406 } 412 }
407 // 发送模板消息 413 // 发送模板消息
408 $send_data = array( 414 $send_data = array(
@@ -412,7 +418,7 @@ class HouseBoard extends Api @@ -412,7 +418,7 @@ class HouseBoard extends Api
412 "remark" => '', 418 "remark" => '',
413 ); 419 );
414 $openid = Db::name('third')->where('user_id',$param['house_user_id'])->value('openid'); 420 $openid = Db::name('third')->where('user_id',$param['house_user_id'])->value('openid');
415 - $url = config('option.vue_url') . '/liuyanxiaoxi?is_template=1&id='.$param['house_user_id']; 421 + $url = config('option.vue_url') . '/liuyanxiaoxi?is_template=1&id='.$message_id;
416 $this->wxsendmessage($openid,$send_data,config('option.template')['msg'],$url); 422 $this->wxsendmessage($openid,$send_data,config('option.template')['msg'],$url);
417 Db::commit(); 423 Db::commit();
418 } catch (PDOException $e) { 424 } catch (PDOException $e) {
@@ -502,9 +508,10 @@ class HouseBoard extends Api @@ -502,9 +508,10 @@ class HouseBoard extends Api
502 'house_user_id' => $wuye_user_id, 508 'house_user_id' => $wuye_user_id,
503 ], 509 ],
504 ]; 510 ];
505 - $order = ['createtime'=>'asc']; 511 + $order = ['createtime'=>'desc'];
506 $comment = $model->pageSelect($page,$where_c,'*',$order,config('option.num')); 512 $comment = $model->pageSelect($page,$where_c,'*',$order,config('option.num'));
507 $list = $comment->items(); 513 $list = $comment->items();
  514 + array_multisort(array_column($list,'createtime'),SORT_ASC,$list);
508 $user_model = new \app\api\model\User(); 515 $user_model = new \app\api\model\User();
509 if(count($list) == 0) { 516 if(count($list) == 0) {
510 $first = [ 517 $first = [
@@ -489,9 +489,9 @@ class Store extends Api @@ -489,9 +489,9 @@ class Store extends Api
489 * @ApiParams (name="store_icon", type="string", required=true, description="店铺图标") 489 * @ApiParams (name="store_icon", type="string", required=true, description="店铺图标")
490 * @ApiParams (name="store_name", type="string", required=true, description="店铺名称") 490 * @ApiParams (name="store_name", type="string", required=true, description="店铺名称")
491 * @ApiParams (name="mobile", type="string", required=true, description="商家电话") 491 * @ApiParams (name="mobile", type="string", required=true, description="商家电话")
492 - * @ApiParams (name="province", type="string", required=true, description="省")  
493 - * @ApiParams (name="city", type="string", required=true, description="市")  
494 - * @ApiParams (name="region", type="string", required=true, description="区") 492 + * @ApiParams (name="province", type="string", required=false, description="省")
  493 + * @ApiParams (name="city", type="string", required=false, description="市")
  494 + * @ApiParams (name="region", type="string", required=false, description="区")
495 * @ApiParams (name="address", type="string", required=false, description="详细地址") 495 * @ApiParams (name="address", type="string", required=false, description="详细地址")
496 * @ApiParams (name="lat", type="string", required=false, description="纬度") 496 * @ApiParams (name="lat", type="string", required=false, description="纬度")
497 * @ApiParams (name="lng", type="string", required=false, description="经度") 497 * @ApiParams (name="lng", type="string", required=false, description="经度")
@@ -697,14 +697,19 @@ class User extends Api @@ -697,14 +697,19 @@ class User extends Api
697 ]; 697 ];
698 $res_msg = $msg_model->edit($update); 698 $res_msg = $msg_model->edit($update);
699 // 发送模板消息 699 // 发送模板消息
700 -// $send_data = array(  
701 -// "first" => '',  
702 -// 'keyword1' => '',  
703 -// "keyword2" => '',  
704 -// "keyword3" => date('Y-m-s',time()),  
705 -// "remark" => '',  
706 -// );  
707 -// $this->wxsendmessage('','',''); 700 + $send_data = array(
  701 + "first" => '您有一条新的消息',
  702 + 'keyword1' => $param['content'] ? $param['content'] : '【图片消息】',
  703 + "keyword2" => date('Y-m-s H:i:s',time()),
  704 + "remark" => '',
  705 + );
  706 + $openid = Db::name('third')->where('user_id',$msg['object_user_id'])->value('openid');
  707 + if($msg['type'] == 2) {
  708 + $url = config('option.vue_url') . '/messageto?is_template=1&id='.$msg['id'];
  709 + } elseif($msg['type'] == 3) {
  710 + $url = config('option.vue_url') . '/liuyanxiaoxi?is_template=1&id='.$msg['id'];
  711 + }
  712 + $this->wxsendmessage($openid,$send_data,config('option.template')['msg'],$url);
708 Db::commit(); 713 Db::commit();
709 } catch (PDOException $e) { 714 } catch (PDOException $e) {
710 Db::rollback(); 715 Db::rollback();
@@ -11,9 +11,9 @@ class StoreValidate extends BaseValidate @@ -11,9 +11,9 @@ class StoreValidate extends BaseValidate
11 'store_icon' => 'require', 11 'store_icon' => 'require',
12 'store_name' => 'require', 12 'store_name' => 'require',
13 'mobile' => 'require|regex:^1\d{10}$', 13 'mobile' => 'require|regex:^1\d{10}$',
14 - 'province' => 'require',  
15 - 'city' => 'require',  
16 - 'region' => 'require', 14 + // 'province' => 'require',
  15 + // 'city' => 'require',
  16 + // 'region' => 'require',
17 'images' => 'require', 17 'images' => 'require',
18 'content' => 'require', 18 'content' => 'require',
19 'image' => 'require', 19 'image' => 'require',
@@ -45,7 +45,7 @@ class StoreValidate extends BaseValidate @@ -45,7 +45,7 @@ class StoreValidate extends BaseValidate
45 'store_add' => ['store_name','house_ids','industry_id','name','mobile','code','license'], // 店铺申请 45 'store_add' => ['store_name','house_ids','industry_id','name','mobile','code','license'], // 店铺申请
46 'store_apply' => ['store_name','province','city','region','name','mobile','code'], // 开通社区提交 46 'store_apply' => ['store_name','province','city','region','name','mobile','code'], // 开通社区提交
47 'store_report' => ['content'], // 举报建议提交 47 'store_report' => ['content'], // 举报建议提交
48 - 'store_edit' => ['store_icon','store_name','mobile','province','city','region','images'], // 店铺信息修改 48 + 'store_edit' => ['store_icon','store_name','mobile','images'], // 店铺信息修改
49 'store_inform_add' => ['content','house_ids','type'], // 发布信息 49 'store_inform_add' => ['content','house_ids','type'], // 发布信息
50 'store_inform_down' => ['type','inform_id'], // 下架/删除信息 50 'store_inform_down' => ['type','inform_id'], // 下架/删除信息
51 'store_inform_score' => ['red_package'], // 计算金额 51 'store_inform_score' => ['red_package'], // 计算金额