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

合并分支 'Branch_liuzhen' 到 'master'

Branch liuzhen



查看合并请求 !305
... ... @@ -143,18 +143,20 @@ class Store extends Backend
// 新增社区有效期
$time = time();
foreach (explode(',',$row->house_ids) as $v) {
$insert = [
'user_id' => $row->user_id,
'store_id' => $row->id,
'house_id' => $v,
'start_time' => $time,
'end_time' => $time + config('site.house_valid'),
'createtime' => $time,
'updatetime' => $time
];
$result_store_house = Db::name('store_house')->insertGetId($insert);
if(!$result_store_house) {
Db::rollback();
if($v) {
$insert = [
'user_id' => $row->user_id,
'store_id' => $row->id,
'house_id' => $v,
'start_time' => $time,
'end_time' => $time + config('site.house_valid') * 86400,
'createtime' => $time,
'updatetime' => $time
];
$result_store_house = Db::name('store_house')->insertGetId($insert);
if(!$result_store_house) {
Db::rollback();
}
}
}
}
... ...
... ... @@ -332,6 +332,7 @@ class House extends Api
"address"://地址
"price"://入驻金额
"shen_status"://状态0选择1申请中2已绑定
"house_valid"://入驻社区有效期(天)
}
]
}
... ... @@ -368,6 +369,7 @@ class House extends Api
$store = $store_model->findOrFail($where,false);
foreach ($data as &$v){
$v['house_valid'] = config('site.house_valid');
$house_ids = explode(',',$store['house_ids']);
if(in_array($v['id'],$house_ids)){
$v['shen_status'] = 2;
... ...
... ... @@ -177,32 +177,34 @@ class Ajax extends Frontend
$res_store = Db::name('store')->where('id',$info['store_id'])->update($update);
// 修改或新增社区有效期
foreach (explode(',',$info['house_ids']) as $v) {
$store_house = Db::name('store_house')->where(['user_id'=>$info['user_id'],'store_id'=>$info['store_id'],'house_id'=>$v])->find();
if($store_house) {
$house_update = [
'id' => $store_house['id']
];
if($store_house['end_time'] > $time) {
$house_update['end_time'] = $store_house['end_time'] + config('site.house_valid');
if($v) {
$store_house = Db::name('store_house')->where(['user_id' => $info['user_id'], 'store_id' => $info['store_id'], 'house_id' => $v])->find();
if ($store_house) {
$house_update = [
'id' => $store_house['id']
];
if ($store_house['end_time'] > $time) {
$house_update['end_time'] = $store_house['end_time'] + config('site.house_valid') * 86400;
} else {
$house_update['end_time'] = $time + config('site.house_valid') * 86400;
}
$result_store_house = Db::name('store_house')->update(['id' => $store_house['id'], '']);
} else {
$house_update['end_time'] = $time + config('site.house_valid');
$insert = [
'user_id' => $info['user_id'],
'store_id' => $info['store_id'],
'house_id' => $v,
'start_time' => $time,
'end_time' => $time + config('site.house_valid'),
'createtime' => $time,
'updatetime' => $time
];
$result_store_house = Db::name('store_house')->insertGetId($insert);
}
if (!$result_store_house) {
Db::rollback();
return false; // 返回处理完成
}
$result_store_house = Db::name('store_house')->update(['id'=>$store_house['id'],'']);
} else {
$insert = [
'user_id' => $info['user_id'],
'store_id' => $info['store_id'],
'house_id' => $v,
'start_time' => $time,
'end_time' => $time + config('site.house_valid'),
'createtime' => $time,
'updatetime' => $time
];
$result_store_house = Db::name('store_house')->insertGetId($insert);
}
if(!$result_store_house) {
Db::rollback();
return false; // 返回处理完成
}
}
if(!$res_order || !$res_store) {
... ...