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

合并分支 'Branch_liuzhen' 到 'master'

Branch liuzhen



查看合并请求 !305
@@ -143,18 +143,20 @@ class Store extends Backend @@ -143,18 +143,20 @@ class Store extends Backend
143 // 新增社区有效期 143 // 新增社区有效期
144 $time = time(); 144 $time = time();
145 foreach (explode(',',$row->house_ids) as $v) { 145 foreach (explode(',',$row->house_ids) as $v) {
146 - $insert = [  
147 - 'user_id' => $row->user_id,  
148 - 'store_id' => $row->id,  
149 - 'house_id' => $v,  
150 - 'start_time' => $time,  
151 - 'end_time' => $time + config('site.house_valid'),  
152 - 'createtime' => $time,  
153 - 'updatetime' => $time  
154 - ];  
155 - $result_store_house = Db::name('store_house')->insertGetId($insert);  
156 - if(!$result_store_house) {  
157 - Db::rollback(); 146 + if($v) {
  147 + $insert = [
  148 + 'user_id' => $row->user_id,
  149 + 'store_id' => $row->id,
  150 + 'house_id' => $v,
  151 + 'start_time' => $time,
  152 + 'end_time' => $time + config('site.house_valid') * 86400,
  153 + 'createtime' => $time,
  154 + 'updatetime' => $time
  155 + ];
  156 + $result_store_house = Db::name('store_house')->insertGetId($insert);
  157 + if(!$result_store_house) {
  158 + Db::rollback();
  159 + }
158 } 160 }
159 } 161 }
160 } 162 }
@@ -332,6 +332,7 @@ class House extends Api @@ -332,6 +332,7 @@ class House extends Api
332 "address"://地址 332 "address"://地址
333 "price"://入驻金额 333 "price"://入驻金额
334 "shen_status"://状态0选择1申请中2已绑定 334 "shen_status"://状态0选择1申请中2已绑定
  335 + "house_valid"://入驻社区有效期(天)
335 } 336 }
336 ] 337 ]
337 } 338 }
@@ -368,6 +369,7 @@ class House extends Api @@ -368,6 +369,7 @@ class House extends Api
368 $store = $store_model->findOrFail($where,false); 369 $store = $store_model->findOrFail($where,false);
369 370
370 foreach ($data as &$v){ 371 foreach ($data as &$v){
  372 + $v['house_valid'] = config('site.house_valid');
371 $house_ids = explode(',',$store['house_ids']); 373 $house_ids = explode(',',$store['house_ids']);
372 if(in_array($v['id'],$house_ids)){ 374 if(in_array($v['id'],$house_ids)){
373 $v['shen_status'] = 2; 375 $v['shen_status'] = 2;
@@ -177,32 +177,34 @@ class Ajax extends Frontend @@ -177,32 +177,34 @@ class Ajax extends Frontend
177 $res_store = Db::name('store')->where('id',$info['store_id'])->update($update); 177 $res_store = Db::name('store')->where('id',$info['store_id'])->update($update);
178 // 修改或新增社区有效期 178 // 修改或新增社区有效期
179 foreach (explode(',',$info['house_ids']) as $v) { 179 foreach (explode(',',$info['house_ids']) as $v) {
180 - $store_house = Db::name('store_house')->where(['user_id'=>$info['user_id'],'store_id'=>$info['store_id'],'house_id'=>$v])->find();  
181 - if($store_house) {  
182 - $house_update = [  
183 - 'id' => $store_house['id']  
184 - ];  
185 - if($store_house['end_time'] > $time) {  
186 - $house_update['end_time'] = $store_house['end_time'] + config('site.house_valid'); 180 + if($v) {
  181 + $store_house = Db::name('store_house')->where(['user_id' => $info['user_id'], 'store_id' => $info['store_id'], 'house_id' => $v])->find();
  182 + if ($store_house) {
  183 + $house_update = [
  184 + 'id' => $store_house['id']
  185 + ];
  186 + if ($store_house['end_time'] > $time) {
  187 + $house_update['end_time'] = $store_house['end_time'] + config('site.house_valid') * 86400;
  188 + } else {
  189 + $house_update['end_time'] = $time + config('site.house_valid') * 86400;
  190 + }
  191 + $result_store_house = Db::name('store_house')->update(['id' => $store_house['id'], '']);
187 } else { 192 } else {
188 - $house_update['end_time'] = $time + config('site.house_valid'); 193 + $insert = [
  194 + 'user_id' => $info['user_id'],
  195 + 'store_id' => $info['store_id'],
  196 + 'house_id' => $v,
  197 + 'start_time' => $time,
  198 + 'end_time' => $time + config('site.house_valid'),
  199 + 'createtime' => $time,
  200 + 'updatetime' => $time
  201 + ];
  202 + $result_store_house = Db::name('store_house')->insertGetId($insert);
  203 + }
  204 + if (!$result_store_house) {
  205 + Db::rollback();
  206 + return false; // 返回处理完成
189 } 207 }
190 - $result_store_house = Db::name('store_house')->update(['id'=>$store_house['id'],'']);  
191 - } else {  
192 - $insert = [  
193 - 'user_id' => $info['user_id'],  
194 - 'store_id' => $info['store_id'],  
195 - 'house_id' => $v,  
196 - 'start_time' => $time,  
197 - 'end_time' => $time + config('site.house_valid'),  
198 - 'createtime' => $time,  
199 - 'updatetime' => $time  
200 - ];  
201 - $result_store_house = Db::name('store_house')->insertGetId($insert);  
202 - }  
203 - if(!$result_store_house) {  
204 - Db::rollback();  
205 - return false; // 返回处理完成  
206 } 208 }
207 } 209 }
208 if(!$res_order || !$res_store) { 210 if(!$res_order || !$res_store) {