|
|
@@ -1479,12 +1479,13 @@ class User extends BaseController
|
|
|
return app('json')->success("数据保存成功");
|
|
|
}
|
|
|
|
|
|
-// 添加客户评论
|
|
|
+ // 添加客户评论
|
|
|
public function comment(Request $request)
|
|
|
{
|
|
|
$post = UtilService::getMore([
|
|
|
['contract_id', '0'], //合约id
|
|
|
['content', ''], //评论内容
|
|
|
+ ['imgs', []], //图片数组,新增
|
|
|
// ['uid',0]
|
|
|
], $request);
|
|
|
$uid = UtilService::getMore([
|
|
|
@@ -1495,7 +1496,6 @@ class User extends BaseController
|
|
|
}else{
|
|
|
$uid = $uid['uid'];
|
|
|
}
|
|
|
-// $uid = $post['uid'];
|
|
|
$time = time();
|
|
|
$info = (new UserContractRecordModel)->where("id", $post["contract_id"])->find();
|
|
|
if (!empty($info)) {
|
|
|
@@ -1506,18 +1506,16 @@ class User extends BaseController
|
|
|
if ($info['status'] != 1) {
|
|
|
return app('json')->fail("只有签约状态才能发表评论");
|
|
|
}
|
|
|
-// var_dump($time);
|
|
|
-// var_dump($info);die();
|
|
|
if ($info['start_time'] > $time || $info['end_time'] < $time) {
|
|
|
return app('json')->fail("只能在签约期间才能发表评论");
|
|
|
+ }
|
|
|
|
|
|
+ // 处理图片数组,用逗号连接成字符串
|
|
|
+ $imgs_str = '';
|
|
|
+ if (!empty($post['imgs']) && is_array($post['imgs'])) {
|
|
|
+ $imgs_str = implode(',', $post['imgs']);
|
|
|
}
|
|
|
-// ->where('start_time','>',$time)->where('end_time','<',$time)
|
|
|
|
|
|
- // 检查签约时间是否为空
|
|
|
-// if (empty($post['id'])) {
|
|
|
-// return app('json')->fail("签字错误");
|
|
|
-// }
|
|
|
$r = (new ContractCommentModel)->save([
|
|
|
'uid' => $uid,
|
|
|
'name' => $info['name'],
|
|
|
@@ -1526,6 +1524,7 @@ class User extends BaseController
|
|
|
'to_uid' => $info['to_uid'],
|
|
|
'to_name' => $info['to_name'],
|
|
|
'content' => $post['content'],
|
|
|
+ 'imgs' => $imgs_str, //新增图片字段
|
|
|
'create_time' => time()
|
|
|
]);
|
|
|
return app('json')->success("数据保存成功");
|