|
|
@@ -1191,6 +1191,7 @@ class User extends BaseController
|
|
|
*/
|
|
|
public function form_save(Request $request){
|
|
|
$post = UtilService::getMore([
|
|
|
+ ['id',0],
|
|
|
['uid','0'], //甲方uid
|
|
|
['phone',''], //甲方手机号
|
|
|
['address',''], //甲方地址
|
|
|
@@ -1202,7 +1203,7 @@ class User extends BaseController
|
|
|
['period',0], // 周期天数
|
|
|
['start_time',''], // 开始时间
|
|
|
['end_time',''], // 结束时间
|
|
|
-
|
|
|
+ ['mark',''] //备注
|
|
|
// ['uid_img',''] //甲方签名图片路径
|
|
|
// ['to_phone',''].
|
|
|
// ['to_address',''],
|
|
|
@@ -1214,11 +1215,18 @@ class User extends BaseController
|
|
|
|
|
|
],$request);
|
|
|
$id = (int)$post["id"];
|
|
|
-
|
|
|
+ unset($post["id"]);
|
|
|
$uid = (int)$post["uid"];
|
|
|
if(empty($uid)){
|
|
|
return app('json')->fail("参数错误");
|
|
|
}
|
|
|
+ $post['start_time'] = strtotime($post['start_time']);
|
|
|
+ $post['end_time'] = strtotime($post['end_time']);
|
|
|
+ $start=(new UserContractRecordModel)->where('to_uid',$post['to_uid'])->where('start_time','<',$post['end_time'])->find();
|
|
|
+ $end=(new UserContractRecordModel)->where('to_uid',$post['to_uid'])->where('end_time','>',$post['start_time'])->find();
|
|
|
+ if (!empty($start)||!empty($end)){
|
|
|
+ return app('json')->fail("与对方其他合约时间有冲突,请与对方协商");
|
|
|
+ }
|
|
|
// $year = $post['year'];
|
|
|
// $month = $post['month'];
|
|
|
// $day = $post['day'];
|
|
|
@@ -1248,11 +1256,11 @@ class User extends BaseController
|
|
|
// }else{
|
|
|
$post['status'] = 0;
|
|
|
// }
|
|
|
- if (empty($id)){
|
|
|
+ if ($id>0){
|
|
|
+ $r = (new UserContractRecordModel)->where("id",$id)->update($post);
|
|
|
+ }else{
|
|
|
$post['contract_no'] = makeOrderId($post['uid'],"CR");
|
|
|
$r = (new UserContractRecordModel)->save($post);
|
|
|
- }else{
|
|
|
- $r = (new UserContractRecordModel)->where("id",$id)->update($post);
|
|
|
}
|
|
|
|
|
|
return app('json')->success("数据保存成功");
|