1 个管道
的构建
通过
耗费
1 秒
Merge branch 'master' of http://114.215.101.231:8099/guosheng/community into Branch_liuzhen
正在显示
1 个修改的文件
包含
20 行增加
和
4 行删除
@@ -141,13 +141,14 @@ class StoreInform extends Backend | @@ -141,13 +141,14 @@ class StoreInform extends Backend | ||
141 | "keyword2" => '审核通过', | 141 | "keyword2" => '审核通过', |
142 | "remark" => ['点击查看详情','#FF0000'], | 142 | "remark" => ['点击查看详情','#FF0000'], |
143 | ); | 143 | ); |
144 | - $store = $row->store; | ||
145 | - $house_ids = trim($store->house_ids,','); | 144 | + // 推广社区 |
145 | + $house_ids = trim($row->house_ids,','); | ||
146 | // 该店铺投放广告的小区业主ID | 146 | // 该店铺投放广告的小区业主ID |
147 | $user_id_arr = \app\api\model\UserHouse::where('status',2) | 147 | $user_id_arr = \app\api\model\UserHouse::where('status',2) |
148 | ->where('house_id','in',$house_ids) | 148 | ->where('house_id','in',$house_ids) |
149 | ->column('user_id'); | 149 | ->column('user_id'); |
150 | if(!empty($user_id_arr)){ | 150 | if(!empty($user_id_arr)){ |
151 | + $store = $row->store; | ||
151 | $send_data1 = array( | 152 | $send_data1 = array( |
152 | "first" => '你家小区附近有商家发福利啦,快来领取!', | 153 | "first" => '你家小区附近有商家发福利啦,快来领取!', |
153 | "keyword1" => $store->store_name, | 154 | "keyword1" => $store->store_name, |
@@ -155,12 +156,27 @@ class StoreInform extends Backend | @@ -155,12 +156,27 @@ class StoreInform extends Backend | ||
155 | "remark" => ['点击领取红包','#FF0000'], | 156 | "remark" => ['点击领取红包','#FF0000'], |
156 | ); | 157 | ); |
157 | $url1 = config('option.vue_url') . '/shopdetails?id='.$store->id; | 158 | $url1 = config('option.vue_url') . '/shopdetails?id='.$store->id; |
158 | - foreach (array_unique($user_id_arr) as $user_id) { | 159 | + // 用户去重 |
160 | + $user_id_arr = array_unique($user_id_arr); | ||
161 | + // 随机红包数量用户 | ||
162 | + $new_user_id_arr = []; | ||
163 | + if(count($user_id_arr) > $row->number){ | ||
164 | + $random_keys = array_rand($user_id_arr,$row->number); | ||
165 | + if(is_array($random_keys)){ | ||
166 | + foreach ($random_keys as $rand) { | ||
167 | + $new_user_id_arr[] = $user_id_arr[$rand]; | ||
168 | + } | ||
169 | + }else{ | ||
170 | + $new_user_id_arr[] = $user_id_arr[$random_keys]; | ||
171 | + } | ||
172 | + }else{ | ||
173 | + $new_user_id_arr = $user_id_arr; | ||
174 | + } | ||
175 | + foreach ($new_user_id_arr as $user_id) { | ||
159 | $openid1 = Db::name('third')->where('user_id',$user_id)->value('openid'); | 176 | $openid1 = Db::name('third')->where('user_id',$user_id)->value('openid'); |
160 | $this->wxsendmessage($openid1,$send_data1,config('option.template')['store_inform'],$url1); | 177 | $this->wxsendmessage($openid1,$send_data1,config('option.template')['store_inform'],$url1); |
161 | } | 178 | } |
162 | } | 179 | } |
163 | - $this->wxsendmessage($openid,$send_data,config('option.template')['ad_pass'],$url); | ||
164 | } | 180 | } |
165 | } | 181 | } |
166 | if($params['status'] == 4) { | 182 | if($params['status'] == 4) { |
-
请 注册 或 登录 后发表评论