作者 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;
*/
class Hot extends Api
{
protected $noNeedLogin = [];
protected $noNeedLogin = ['banner'];
protected $noNeedRight = ['*'];
protected $store_model;
protected $store_inform_model;
... ... @@ -51,6 +51,39 @@ class Hot extends Api
/**
* 商圈信息列表
* @ApiWeigh (90)
* @ApiTitle (首页轮播图)
* @ApiSummary (首页轮播图)
* @ApiMethod (POST)
* @ApiRoute (/api/hot/banner)
*
* @ApiReturn({
"code": 1,
"msg": "success",
"time": "1600064624",
"data": [{
"id": 1,
"image": "http://community.qiniu.brotop.cn/uploads/20200910/0afb1f6a54b2ca30a2fa3f3f6cafbd3f.jpg",
"weigh": 1,
"createtime": "2020-09-10 11:47:28"
}]
})
*/
public function banner()
{
$data = Db::name('store_banner')
->field('updatetime',true)
->order(['weigh'=>'desc','createtime'=>'asc'])
->select();
foreach ($data as &$v){
$v['image'] = cdnurl($v['image'],true);
$v['createtime'] = date('Y-m-d H:i:s',$v['createtime']);
}
$this->success('success',$data);
}
/**
* 商圈信息列表
* @ApiWeigh (80)
*
* @ApiTitle (商圈信息列表)
... ...
... ... @@ -13,6 +13,8 @@ use app\common\controller\Api;
use think\Cache;
use think\Db;
use think\Validate;
use think\Exception;
use think\exception\PDOException;
use app\api\model\House;
use app\api\model\HouseAdmin as HouseAdminModel;
use app\api\model\HouseBoard;
... ... @@ -255,7 +257,7 @@ class HouseAdmin extends Api
$where = ['hb.house_id'=>$house_id];
$total_num = HouseBoard::where($where)
->alias('hb')
->join('house_admin ha','ha.user_id = hb.admin_user_id')
->join('house_admin ha','ha.id = hb.admin_user_id')
->count();
$list = $this->getBoardList($where,$page,$pageNum);
$this->success('success',compact('total_num','list'));
... ... @@ -418,7 +420,7 @@ class HouseAdmin extends Api
Db::startTrans();
try{
(new HouseBoard)->allowField(true)->save(array_merge([
'admin_user_id' => $this->auth->id
'admin_user_id' => $admin['id']
],$post));
// 该社区下的业主ID
$user_id_arr = UserHouse::where('house_id',$post['house_id'])
... ...
... ... @@ -255,6 +255,10 @@ class HouseBoard extends Api
}
}
// 因为公告首页接口已经返回了最新的公告,所以这里防止重复就去掉最新的
if(empty($page) || $page == 1){
array_shift($data['info']);
}
$this->success('success',$data);
}
... ... @@ -396,6 +400,7 @@ class HouseBoard extends Api
'is_read_user' => 1
];
$res_msg = $msg_model->edit($update);
$message_id = $msg['id'];
} else {
$insert = $where_m;
$insert['type'] = 3;
... ... @@ -403,6 +408,7 @@ class HouseBoard extends Api
$insert['image'] = $param['image'];
$insert['is_read_user'] = 2;
$res_msg = $msg_model->add($insert);
$message_id = $msg_model->where($where_m)->value('id');
}
// 发送模板消息
$send_data = array(
... ... @@ -412,7 +418,7 @@ class HouseBoard extends Api
"remark" => '',
);
$openid = Db::name('third')->where('user_id',$param['house_user_id'])->value('openid');
$url = config('option.vue_url') . '/liuyanxiaoxi?is_template=1&id='.$param['house_user_id'];
$url = config('option.vue_url') . '/liuyanxiaoxi?is_template=1&id='.$message_id;
$this->wxsendmessage($openid,$send_data,config('option.template')['msg'],$url);
Db::commit();
} catch (PDOException $e) {
... ... @@ -502,9 +508,10 @@ class HouseBoard extends Api
'house_user_id' => $wuye_user_id,
],
];
$order = ['createtime'=>'asc'];
$order = ['createtime'=>'desc'];
$comment = $model->pageSelect($page,$where_c,'*',$order,config('option.num'));
$list = $comment->items();
array_multisort(array_column($list,'createtime'),SORT_ASC,$list);
$user_model = new \app\api\model\User();
if(count($list) == 0) {
$first = [
... ...
... ... @@ -489,9 +489,9 @@ class Store extends Api
* @ApiParams (name="store_icon", type="string", required=true, description="店铺图标")
* @ApiParams (name="store_name", type="string", required=true, description="店铺名称")
* @ApiParams (name="mobile", type="string", required=true, description="商家电话")
* @ApiParams (name="province", type="string", required=true, description="省")
* @ApiParams (name="city", type="string", required=true, description="市")
* @ApiParams (name="region", type="string", required=true, description="区")
* @ApiParams (name="province", type="string", required=false, description="省")
* @ApiParams (name="city", type="string", required=false, description="市")
* @ApiParams (name="region", type="string", required=false, description="区")
* @ApiParams (name="address", type="string", required=false, description="详细地址")
* @ApiParams (name="lat", type="string", required=false, description="纬度")
* @ApiParams (name="lng", type="string", required=false, description="经度")
... ...
... ... @@ -697,14 +697,19 @@ class User extends Api
];
$res_msg = $msg_model->edit($update);
// 发送模板消息
// $send_data = array(
// "first" => '',
// 'keyword1' => '',
// "keyword2" => '',
// "keyword3" => date('Y-m-s',time()),
// "remark" => '',
// );
// $this->wxsendmessage('','','');
$send_data = array(
"first" => '您有一条新的消息',
'keyword1' => $param['content'] ? $param['content'] : '【图片消息】',
"keyword2" => date('Y-m-s H:i:s',time()),
"remark" => '',
);
$openid = Db::name('third')->where('user_id',$msg['object_user_id'])->value('openid');
if($msg['type'] == 2) {
$url = config('option.vue_url') . '/messageto?is_template=1&id='.$msg['id'];
} elseif($msg['type'] == 3) {
$url = config('option.vue_url') . '/liuyanxiaoxi?is_template=1&id='.$msg['id'];
}
$this->wxsendmessage($openid,$send_data,config('option.template')['msg'],$url);
Db::commit();
} catch (PDOException $e) {
Db::rollback();
... ...
... ... @@ -11,9 +11,9 @@ class StoreValidate extends BaseValidate
'store_icon' => 'require',
'store_name' => 'require',
'mobile' => 'require|regex:^1\d{10}$',
'province' => 'require',
'city' => 'require',
'region' => 'require',
// 'province' => 'require',
// 'city' => 'require',
// 'region' => 'require',
'images' => 'require',
'content' => 'require',
'image' => 'require',
... ... @@ -45,7 +45,7 @@ class StoreValidate extends BaseValidate
'store_add' => ['store_name','house_ids','industry_id','name','mobile','code','license'], // 店铺申请
'store_apply' => ['store_name','province','city','region','name','mobile','code'], // 开通社区提交
'store_report' => ['content'], // 举报建议提交
'store_edit' => ['store_icon','store_name','mobile','province','city','region','images'], // 店铺信息修改
'store_edit' => ['store_icon','store_name','mobile','images'], // 店铺信息修改
'store_inform_add' => ['content','house_ids','type'], // 发布信息
'store_inform_down' => ['type','inform_id'], // 下架/删除信息
'store_inform_score' => ['red_package'], // 计算金额
... ...