作者 lihan
1 个管道 的构建 通过 耗费 0 秒

项目细节完善

... ... @@ -448,9 +448,10 @@ class CenterController extends HomeBaseController
}
}
public function confirmOrder() {
public function confirmOrder()
{
$request = request();
if($request->isAjax()) {
if ($request->isAjax()) {
if (Db::name('order_info')->where(['id' => $request->param('oid')])->value('status') == 4) {
$data = [
'id' => $request->param('oid'),
... ... @@ -470,20 +471,31 @@ class CenterController extends HomeBaseController
}
}
public function comment(){
public function comment()
{
$request = request();
if($request->isAjax()) {
if ($request->isAjax()) {
$data = $request->param();
$oid = $data['oid'];
unset($data['oid']);
$data['user_id'] = session('user.id');
$data['comment_time'] = time();
$data['activity_id'] = Db::name('order_info')->where(['id'=>$data['oid']])->value('activity_id');
unset($data['oid']);
if(Db::name('activity_comment')->insert($data)) {
$this->success('评论成功', url('user/Center/orderDetail', ['oid'=>$request->param('oid')]), true);
}else {
$data['activity_id'] = Db::name('order_info')->where(['id' => $oid])->value('activity_id');
Db::startTrans();
if (Db::name('activity_comment')->insert($data)) {
//改变订单状态
if (Db::name('order_info')->update(['id' => $oid, 'status' => 6])) {
Db::commit();
$this->success('评论成功', url('user/Center/orderDetail', ['oid' => $request->param('oid')]), true);
} else {
Db::rollback();
$this->success('评论失败', '', false);
}
}else {
} else {
Db::rollback();
$this->success('评论失败', '', false);
}
} else {
return $this->fetch(':comment', [
'oid' => request()->param('oid')
]);
... ...