|
@@ -217,27 +217,30 @@ class KFMessageController extends CatchController
|
|
|
*/
|
|
|
public function delete(Request $request){
|
|
|
$this->validate($request, [
|
|
|
- 'id' => 'required'
|
|
|
+ 'ids' => 'required'
|
|
|
]);
|
|
|
$now = date('Y-m-d H:i:s');
|
|
|
- DB::table('wechat_kf_messages')
|
|
|
- ->where([
|
|
|
- ['id', '=', $request->input('id')],
|
|
|
- ['user_id', '=', $this->getLoginUserId()],
|
|
|
- ['status', '<>', WechatPlatformConstService::KF_MESSAGE_STATUS_SENDING],
|
|
|
- ['is_enabled', '=', 1],
|
|
|
- ])->update([
|
|
|
- 'is_enabled' => 0,
|
|
|
- 'updated_at' => $now,
|
|
|
- ]);
|
|
|
- DB::table('wechat_kf_message_send_records')
|
|
|
- ->where([
|
|
|
- ['message_id', '=', $request->input('id')],
|
|
|
- ['is_enabled', '=', 1]
|
|
|
- ])->update([
|
|
|
- 'is_enabled' => 0,
|
|
|
- 'updated_at' => $now,
|
|
|
- ]);
|
|
|
+
|
|
|
+ foreach ($request->input('ids') as $id) {
|
|
|
+ DB::table('wechat_kf_messages')
|
|
|
+ ->where([
|
|
|
+ ['id', '=', $id],
|
|
|
+ ['user_id', '=', $this->getLoginUserId()],
|
|
|
+ ['status', '<>', WechatPlatformConstService::KF_MESSAGE_STATUS_SENDING],
|
|
|
+ ['is_enabled', '=', 1],
|
|
|
+ ])->update([
|
|
|
+ 'is_enabled' => 0,
|
|
|
+ 'updated_at' => $now,
|
|
|
+ ]);
|
|
|
+ DB::table('wechat_kf_message_send_records')
|
|
|
+ ->where([
|
|
|
+ ['message_id', '=', $id],
|
|
|
+ ['is_enabled', '=', 1]
|
|
|
+ ])->update([
|
|
|
+ 'is_enabled' => 0,
|
|
|
+ 'updated_at' => $now,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
return 'ok';
|
|
|
}
|
|
|
|