where([ 'is_delete' => 0, 'store_id' => get_store_id() ]); if ($is_show != -1) { $query->andWhere(['is_show' => intval($is_show)]); } if (!empty($name)) { $query->andWhere(['like', 'name', $name]); } $query->orderBy(['sort' => SORT_DESC]); $list = pagination_make($query); return $this->asJson([ 'code' => 0, 'msg' => 'success', 'data' => [ 'data' => $list['list'], 'pageNo' => $list['pageNo'], 'totalCount' => $list['totalCount'], ], ]); } /** * 分类状态修改 * @return \yii\web\Response */ public function actionCatStatus() { $id = post_params('id'); $type = post_params('type'); $status = post_params('status', 1); $status = intval($status); // 1:禁用,2: 删除 if (!in_array($type, [1, 2]) || empty($id)) { return $this->asJson([ 'code' => 1, 'msg' => '参数错误' ]); } if (!is_array($id)) { $cat_id[] = intval($id); } else { $cat_id = $id; } $t = \Yii::$app->db->beginTransaction(); foreach ($cat_id as $_id) { $cat = VideoGoodsCat::findOne($_id); if (!$cat) { $t->rollBack(); return $this->asJson([ 'code' => 1, 'msg' => '未找到ID:' . $_id . '记录' ]); } if ($type == 1) { if ($status == 1) { VideoGoodsCat::updateAll(['is_show' => 1], ['id' => $cat->id]); } else { VideoGoodsCat::updateAll(['is_show' => 0], ['id' => $cat->id]); } } else { VideoGoodsCat::updateAll(['is_delete' => 1], ['id' => $cat->id]); } $cat->updated_at = time(); if (!$cat->save()) { $t->rollBack(); return $this->asJson([ 'code' => 1, 'msg' => 'ID: ' . $_id . '处理失败' ]); } } $t->commit(); return $this->asJson([ 'code' => 0, 'msg' => '处理成功' ]); } /** * 分类删除 * @return \yii\web\Response */ public function actionCatDel() { $id = post_params('id'); if (empty($id)) { return $this->asJson([ 'code' => 1, 'msg' => '缺少参数或参数错误' ]); } if (is_array($id)) { $count_ids = count($id); $update_num = VideoGoodsCat::updateAll(['is_delete' => 1], ['in', 'id', $id]); if ($update_num == $count_ids) { return $this->asJson([ 'code' => 0, 'msg' => '删除成功' ]); } else { return $this->asJson([ 'code' => 0, 'msg' => '有' . ($count_ids - $update_num ) . '条数据未删除成功,请稍后重试' ]); } } else { $cat = VideoGoodsCat::findOne($id); $cat->is_delete = 1; if ($cat->save()) { return $this->asJson([ 'code' => 0, 'msg' => '删除成功' ]); } return $this->asJson([ 'code' => 1, 'msg' => '删除失败', ]); } } /** * 分类编辑 * @return \yii\web\Response */ public function actionCatEdit() { $store_id = get_store_id(); $id = post_params('id', 0); $name = post_params('name'); if (empty($name)) { return $this->asJson([ 'code' => 1, 'msg' => '名称不能为空' ]); } $pic_url = post_params('pic_url', ''); $sort = post_params('sort',0); $is_show = post_params('is_show', 0); if ($id > 0) { $cat = VideoGoodsCat::findOne($id); } else { $cat = new VideoGoodsCat(); } $cat->store_id = $store_id; $cat->name = $name; $cat->pic_url = $pic_url; $cat->sort = $sort; $cat->is_show = $is_show; if ($cat->save()) { return $this->asJson([ 'code' => 0, 'msg' => $id > 0 ? '编辑成功' : '添加成功', ]); } return $this->asJson([ 'code' => 1, 'msg' => $id > 0 ? '编辑失败' : '添加失败', ]); } /** * 获取抖品设置 */ public function actionSetting() { $setting = VideoGoodsSetting::findOne(['store_id' => get_store_id()]); if (!$setting) { return $this->asJson([ 'code' => 0, 'msg' => 'success', 'data' => [ 'is_video_audit' => 0, 'is_author_audit' => 0, 'profit' => 0, 'verify' => [], 'video_analyze_345' => Option::get('video_analyze_345', get_store_id(), 'saas')['value'], 'rewards' => VideoGoodsSetting::REWAEDS_DEFAULT ] ]); } return $this->asJson([ 'code' => 0, 'msg' => 'success', 'data' => [ 'is_video_audit' => $setting->is_video_audit, 'is_author_audit' => $setting->is_author_audit, 'profit' => $setting->profit, 'verify' => json_decode($setting->verify) ?: [], 'video_analyze_345' => Option::get('video_analyze_345', get_store_id(), 'saas')['value'], 'rewards' => empty($setting->rewards) ? VideoGoodsSetting::REWAEDS_DEFAULT : json_decode($setting->rewards,true) ] ]); } /** * 抖品设置 */ public function actionSetSetting() { $is_video_audit = post_params('is_video_audit'); $is_author_audit = post_params('is_author_audit'); $verify = post_params("verify"); $rewards = post_params("rewards"); $profit = post_params('profit', 0); $video_analyze_345 = post_params('video_analyze_345', 0); Option::set('video_analyze_345', $video_analyze_345, get_store_id(), 'saas'); $setting = VideoGoodsSetting::findOne(['store_id' => get_store_id()]); if (!$setting) { $setting = new VideoGoodsSetting(); $setting->store_id = get_store_id(); } $setting->is_author_audit = intval($is_author_audit); $setting->is_video_audit = intval($is_video_audit); $setting->profit = $profit; $setting->verify = json_encode($verify) ?: ""; $setting->rewards = json_encode($rewards) ?: ""; if ($setting->save()) { return $this->asJson([ 'code' => 0, 'msg' => '设置成功' ]); } return $this->asJson([ 'code' => 1, 'msg' => '设置失败' ]); } /** * 添加视频商品 */ public function actionAddGoods() { $goods_id = post_params('goods_id'); if (empty($goods_id)) { return $this->asJson([ 'code' => 1, 'msg' => '参数错误' ]); } if (!is_array($goods_id)) { $goods_ids[] = $goods_id; } else { $goods_ids = $goods_id; } foreach ($goods_ids as $_id) { $goods = VideoGoods::findOne(['store_id' => get_store_id(), 'goods_id' => $_id, 'is_delete' => 0]); if (!$goods) { $video_goods = new VideoGoods(); $video_goods->goods_id = $_id; $video_goods->store_id = get_store_id(); $video_goods->is_delete = 0; $video_goods->status = 0; $video_goods->save(); } } return $this->asJson([ 'code' => 0, 'msg' => '添加成功' ]); } /** * 获取商城可选择的商品列表 * @return \yii\web\Response */ public function actionStoreGoodsList() { return $this->asJson(Goods::getGoodsList(get_params())); } /** * 视频商品列表 */ public function actionGoodsList() { $params = get_params(); $video_goods = VideoGoods::find()->where(['store_id' => get_store_id(), 'is_delete' => 0]); if (isset($params['status']) && $params['status'] != -1) { $video_goods->andWhere(['status' => $params['status']]); } $video_goods = $video_goods->asArray()->all(); if (!empty($video_goods)) { $params = array_merge($params, ['goods_id' => array_column($video_goods, 'goods_id')]); } else { $params = array_merge($params, ['goods_id' => []]); } \Yii::error($params); return $this->asJson(Goods::getGoodsList($params, true)); } /** * 商品状态修改 * @return \yii\web\Response */ public function actionGoodsStatus() { $id = post_params('id'); $status = post_params('status'); $store_id = get_store_id(); if (empty($id) || !in_array($status, [0, 1])) { return $this->asJson([ 'code' => 1, 'msg' => '缺少参数或参数错误' ]); } if (is_array($id)) { $count_ids = count($id); $update_num = VideoGoods::updateAll(['status' => intval($status)], ['in', 'id', $id]); if ($update_num == $count_ids) { if (count($id) === 1) { (new DiyCommon)->JobBehaviors($store_id, StoreSyncExtLog::TYPE_VIDEO_GOODS, $id); } return $this->asJson([ 'code' => 0, 'msg' => '更新成功' ]); } else { return $this->asJson([ 'code' => 0, 'msg' => '有' . ($count_ids - $update_num ) . '条数据未更新成功,请稍后重试' ]); } } else { $video_goods = VideoGoods::findOne($id); $video_goods->status = $status; if ($video_goods->save()) { return $this->asJson([ 'code' => 0, 'msg' => '更新成功' ]); } return $this->asJson([ 'code' => 1, 'msg' => '修改失败', ]); } } /** * 商品删除 * @return \yii\web\Response */ public function actionGoodsDel() { $id = post_params('id'); $store_id = get_store_id(); if (empty($id)) { return $this->asJson([ 'code' => 1, 'msg' => '缺少参数或参数错误' ]); } if (is_array($id)) { $count_ids = count($id); $update_num = VideoGoods::updateAll(['is_delete' => 1], ['in', 'id', $id]); if ($update_num == $count_ids) { if (count($id) === 1) { (new DiyCommon)->JobBehaviors($store_id, StoreSyncExtLog::TYPE_VIDEO_GOODS, $id); } return $this->asJson([ 'code' => 0, 'msg' => '更新成功' ]); } else { return $this->asJson([ 'code' => 0, 'msg' => '有' . ($count_ids - $update_num ) . '条数据未更新成功,请稍后重试' ]); } } else { $video_goods = VideoGoods::findOne($id); $video_goods->is_delete = 1; if ($video_goods->save()) { return $this->asJson([ 'code' => 0, 'msg' => '更新成功' ]); } return $this->asJson([ 'code' => 1, 'msg' => '修改失败', ]); } } /** * 举报列表 */ public function actionReportList() { $type = get_params('type', -1); $status = get_params('status', -1); $report_id = get_params('report_id', 0); $title = get_params('title', ''); $name = get_params('name', ''); $query = VideoGoodsReport::find()->alias('vgr')->where(['vgr.store_id' => get_store_id(), 'vgr.is_delete' => 0]) ->leftJoin(['u' => User::tableName()], 'u.id=vgr.user_id') ->leftJoin(['su' => SaasUser::tableName()], 'su.mobile=u.binding') ->leftJoin(['vgl' => VideoGoodsList::tableName()], 'vgl.id=vgr.vl_id') ->leftJoin(['vu' => User::tableName()], 'vu.id=vgl.user_id') ->leftJoin(['vsu' => SaasUser::tableName()], 'vsu.mobile=vu.binding'); // 举报类型 if (in_array(intval($type), VideoGoodsReport::$validReportType)) { $query->andWhere(['vgr.type' => $type]); } // 举报视频的标题或内容 if (!empty($title)) { $query->andWhere(['or', ['like', 'vgl.title', $title], ['like', 'vgl.content', $title]]); } // 举报人昵称 if (!empty($name)) { $query->andWhere(['like', 'su.name', $name]); } // 状态 if (in_array(intval($status), [0, 1])) { $query->andWhere(['vgr.status' => $status]); } // 举报id if (!empty($report_id)) { $query->andWhere(['vgr.id' => $report_id]); } $query->orderBy('vgr.id desc, vgr.status asc')->select( 'vgr.id report_id, vgr.store_id, vgr.user_id report_user_id, su.name report_user_name, su.avatar report_avatar, vgr.vl_id, vgr.pic_url report_pic_url, vgr.desc report_desc, vgr.type report_type, vgr.status report_status, vgl.title vl_title, vgl.cat_id vl_cat_id, vgl.is_delete vl_is_delete, vgl.is_show vl_is_show, vgl.cover_pic vl_cover_pic, vgl.pic_list vl_pic_list, vgl.video_url vl_video_url, vgl.content vl_content, vgl.type vl_type, vgr.created_at report_created_at, vgr.updated_at report_updated_at, vsu.name reported_name, vsu.avatar reported_avatar' ); $list = pagination_make($query); if (!empty($list['list'])) { foreach ($list['list'] as $key => $value) { $list['list'][$key]['cat_name'] = VideoGoodsCat::findOne($value['vl_cat_id'])->name; $list['list'][$key]['vl_pic_list'] = Json::decode($value['vl_pic_list']); } } return $this->asJson([ 'code' => 0, 'msg' => 'success', 'data' => [ 'data' => $list['list'], 'pageNo' => $list['pageNo'], 'totalCount' => $list['totalCount'], ], ]); } /** * 处理举报 */ public function actionHandleReport() { $id = post_params('id'); $type = post_params('type'); // 1:下架视频,2: 删除视频 if (!in_array($type, [1, 2]) || empty($id)) { return $this->asJson([ 'code' => 1, 'msg' => '参数错误' ]); } if (!is_array($id)) { $report_id[] = intval($id); } else { $report_id = $id; } $t = \Yii::$app->db->beginTransaction(); foreach ($report_id as $_id) { $video_report = VideoGoodsReport::findOne($_id); if (!$video_report) { $t->rollBack(); return $this->asJson([ 'code' => 1, 'msg' => '未找到ID:' . $_id . '记录' ]); } if ($type == 1) { VideoGoodsList::updateAll(['is_show' => 0], ['id' => $video_report->vl_id]); } else { VideoGoodsList::updateAll(['is_delete' => 1], ['id' => $video_report->vl_id]); } $video_report->status = 1; $video_report->updated_at = time(); if (!$video_report->save()) { $t->rollBack(); return $this->asJson([ 'code' => 1, 'msg' => 'ID: ' . $_id . '处理失败' ]); } } $t->commit(); return $this->asJson([ 'code' => 0, 'msg' => '处理成功' ]); } /** * 作品列表 */ public function actionList() { $cat_id = get_params('cat_id', 0); $type = get_params('type', 0); $status = get_params('status', -1); $name = get_params('name', ''); $mobile = get_params('mobile', ''); $id = get_params('id', 0); $user_id = get_params('user_id', 0); $query = VideoGoodsList::find()->alias('vgl')->where(['vgl.store_id' => get_store_id(), 'vgl.is_delete' => 0]) ->leftJoin(['u' => User::tableName()], 'u.id=vgl.user_id') ->leftJoin(['su' => SaasUser::tableName()], 'su.mobile=u.binding') ->leftJoin(['vgc' => VideoGoodsCat::tableName()], 'vgc.id=vgl.cat_id'); // 分类 if (!empty($cat_id)) { $query->andWhere(['vgl.cat_id' => $cat_id]); } // 用户id if (!empty($user_id)) { $query->andWhere(['vgl.user_id' => $user_id]); } // 作品id if (!empty($id)) { $query->andWhere(['vgl.id' => $id]); } // 1:视频,2:图文 if (!empty($type)) { $query->andWhere(['vgl.type' => $type]); } // 0:待审核。1:已通过,2:已拒绝 if (in_array(intval($status), [0, 1, 2])) { $query->andWhere(['vgl.status' => $status]); } // 昵称 if (!empty($name)) { $query->andWhere(['like', 'su.name', $name]); } // 电话 if (!empty($mobile)) { $query->andWhere(['like', 'su.mobile', $mobile]); } $query->orderBy('vgl.id desc, vgl.status asc')->select( 'vgl.*, su.name user_name, su.mobile user_mobile, su.avatar user_avatar' ); $list = pagination_make($query); if (!empty($list['list'])) { foreach ($list['list'] as $key => $value) { $list['list'][$key]['cat_name'] = VideoGoodsCat::findOne($value['cat_id'])->name; $list['list'][$key]['pic_list'] = Json::decode($value['pic_list']); } } return $this->asJson([ 'code' => 0, 'msg' => 'success', 'data' => [ 'data' => $list['list'], 'pageNo' => $list['pageNo'], 'totalCount' => $list['totalCount'], ], ]); } /** * 审核作品 */ public function actionAudit() { $id = post_params('id'); $status = post_params('status', 0); $refuse_desc = post_params('refuse_desc', ''); if (empty($id)) { return $this->asJson([ 'code' => 1, 'msg' => '参数不正确' ]); } if (!in_array($status, [1, 2])) { return $this->asJson([ 'code' => 1, 'msg' => '参数不正确' ]); } if (is_array($id)) { $video_id_arr = $id; } else { $video_id_arr[] = intval($id); } foreach ($video_id_arr as $video_id) { $video_goods = VideoGoodsList::findOne(['id' => $video_id, 'status' => 0]); if (!$video_goods) { return $this->asJson([ 'code' => 1, 'msg' => '作品不存在或不需要重复处理' ]); } $video_goods->status = $status; if (!empty($refuse_desc) && $status == 2) { $video_goods->refuse_desc = $refuse_desc; } $video_goods->updated_at = time(); if (!$video_goods->save()) { return $this->asJson([ 'code' => 1, 'msg' => $video_goods->errors[0] ]); } } return $this->asJson([ 'code' => 0, 'msg' => '审核成功' ]); } /** * 操作作品状态 * @return \yii\web\Response */ public function actionHandleVideo() { $id = post_params('id'); $type = post_params('type'); $status = post_params('status', 1); $status = intval($status); // 1:禁用,2: 删除 if (!in_array($type, [1, 2]) || empty($id)) { return $this->asJson([ 'code' => 1, 'msg' => '参数错误' ]); } if (!is_array($id)) { $video_id[] = intval($id); } else { $video_id = $id; } $t = \Yii::$app->db->beginTransaction(); foreach ($video_id as $_id) { $video = VideoGoodsList::findOne($_id); if (!$video) { $t->rollBack(); return $this->asJson([ 'code' => 1, 'msg' => '未找到ID:' . $_id . '记录' ]); } if ($type == 1) { if ($status == 1) { VideoGoodsList::updateAll(['is_show' => 1], ['id' => $video->id]); } else { VideoGoodsList::updateAll(['is_show' => 0], ['id' => $video->id]); } } else { VideoGoodsList::updateAll(['is_delete' => 1], ['id' => $video->id]); } $video->updated_at = time(); if (!$video->save()) { $t->rollBack(); return $this->asJson([ 'code' => 1, 'msg' => 'ID: ' . $_id . '处理失败' ]); } } $t->commit(); return $this->asJson([ 'code' => 0, 'msg' => '处理成功' ]); } /** * 作者列表 */ public function actionAuthorList() { $name = get_params('name', ''); $mobile = get_params('mobile', ''); $status = get_params('status', -1); $query = VideoGoodsAuthor::find()->alias('vga')->where(['vga.store_id' => get_store_id(), 'vga.is_delete' => 0]) ->leftJoin(['u' => User::tableName()], 'u.id=vga.user_id') ->leftJoin(['su' => SaasUser::tableName()], 'su.mobile=u.binding'); if (!empty($name)) { $query->andWhere(['like', 'su.name', $name]); } if (!empty($mobile)) { $query->andWhere(['like', 'su.mobile', $mobile]); } if (in_array($status, [0, 1, 2])) { $query->andWhere(['vga.status' => $status]); } $query->orderBy('vga.id desc, vga.status asc')->select( 'vga.id, vga.user_id, vga.is_delete, vga.is_show, vga.created_at, vga.store_id, vga.status, su.name, su.mobile, su.avatar, vga.card_type, vga.card_front, vga.card_before, vga.name, vga.mobile, vga.desc' ); $list = pagination_make($query); if (!empty($list['list'])) { foreach ($list['list'] as &$value) { // 获赞数 $value['like_count'] = VideoGoodsVote::find()->where(['store_id' => $value['store_id'], 'is_delete' => 0, 'is_cancel' => 0, 'type' => 1, 'vl_user_id' => $value['user_id']])->count(); // 收藏数 $value['collect_count'] = VideoGoodsVote::find()->where(['store_id' => $value['store_id'], 'is_delete' => 0, 'is_cancel' => 0, 'type' => 2, 'vl_user_id' => $value['user_id']])->count(); // 粉丝数 $value['fans_count'] = VideoGoodsFocus::find()->where(['store_id' => $value['store_id'], 'is_delete' => 0, 'is_cancel' => 0, 'focus_user_id' => $value['user_id']])->count(); // 关注数 $value['focus_count'] = VideoGoodsFocus::find()->where(['store_id' => $value['store_id'], 'is_delete' => 0, 'is_cancel' => 0, 'user_id' => $value['user_id']])->count(); } } return $this->asJson([ 'code' => 0, 'msg' => 'success', 'data' => [ 'data' => $list['list'], 'pageNo' => $list['pageNo'], 'totalCount' => $list['totalCount'], ], ]); } /** * 作者审核 */ public function actionAuditAuthor() { $id = post_params('id'); $status = post_params('status', 0); if (empty($id)) { return $this->asJson([ 'code' => 1, 'msg' => '参数不正确' ]); } if (!in_array($status, [1, 2])) { return $this->asJson([ 'code' => 1, 'msg' => '参数不正确' ]); } if (is_array($id)) { $author_id_arr = $id; } else { $author_id_arr[] = intval($id); } foreach ($author_id_arr as $author_id) { $author = VideoGoodsAuthor::findOne(['id' => $author_id, 'status' => 0]); if (!$author) { return $this->asJson([ 'code' => 1, 'msg' => '作者不存在或不需要重复处理' ]); } $author->status = $status; $author->updated_at = time(); if (!$author->save()) { return $this->asJson([ 'code' => 1, 'msg' => $author->errors[0] ]); } } return $this->asJson([ 'code' => 0, 'msg' => '审核成功' ]); } /** * 操作作者状态 * @return \yii\web\Response */ public function actionHandleAuthor() { $id = post_params('id'); $type = post_params('type'); $status = post_params('status', 1); $status = intval($status); // 1:禁用,2: 删除 if (!in_array($type, [1, 2]) || empty($id)) { return $this->asJson([ 'code' => 1, 'msg' => '参数错误' ]); } if (!is_array($id)) { $author_id[] = intval($id); } else { $author_id = $id; } $t = \Yii::$app->db->beginTransaction(); foreach ($author_id as $_id) { $author = VideoGoodsAuthor::findOne($_id); if (!$author) { $t->rollBack(); return $this->asJson([ 'code' => 1, 'msg' => '未找到ID:' . $_id . '记录' ]); } if ($type == 1) { if ($status == 1) { VideoGoodsAuthor::updateAll(['is_show' => 1], ['id' => $author->id]); } else { VideoGoodsAuthor::updateAll(['is_show' => 0], ['id' => $author->id]); } } else { VideoGoodsAuthor::updateAll(['is_delete' => 1], ['id' => $author->id]); // 删除作品 VideoGoodsList::updateAll(['is_delete' => 1], ['store_id' => get_store_id(), 'user_id' => $author->user_id]); } $author->updated_at = time(); if (!$author->save()) { $t->rollBack(); return $this->asJson([ 'code' => 1, 'msg' => 'ID: ' . $_id . '处理失败' ]); } } $t->commit(); return $this->asJson([ 'code' => 0, 'msg' => '处理成功' ]); } /** * 用户关注或粉丝列表 */ public function actionUserFocusList() { $user_id = get_params('user_id', 0); $type = get_params('type', 0); $name = get_params('name', ''); $mobile = get_params('mobile', ''); $query = VideoGoodsFocus::find()->alias('vgf')->where(['vgf.store_id' => get_store_id(), 'vgf.is_delete' => 0, 'vgf.is_cancel' => 0, 'vgf.user_id' => $user_id]) ->leftJoin(['u' => User::tableName()], 'u.id=vgf.focus_user_id') ->leftJoin(['su' => SaasUser::tableName()], 'su.mobile=u.binding'); // 默认0,关注列表,其他粉丝列表 if (!empty($type)) { $query->andWhere(['vgf.user_id' => $user_id]); } else { // 粉丝列表 $query->andWhere(['vgf.focus_user_id' => $user_id]); } if (!empty($name)) { $query->andWhere(['like', 'su.name', $name]); } if (!empty($mobile)) { $query->andWhere(['like', 'su.mobile', $mobile]); } $query->orderBy('vgf.created_at desc')->select( 'vgf.*, su.name focus_user_name, su.mobile focus_user_mobile, su.avatar focus_user_avatar' ); $list = pagination_make($query); return $this->asJson([ 'code' => 0, 'msg' => 'success', 'data' => [ 'data' => $list['list'], 'pageNo' => $list['pageNo'], 'totalCount' => $list['totalCount'], ], ]); } /** * 某个作品或用户的点赞,收藏,转发数据 */ public function actionVoteList() { $user_id = get_params('user_id', 0); $vl_id = get_params('vl_id', 0); $type = get_params('type', -1); $name = get_params('name', ''); $mobile = get_params('mobile', ''); if (empty($user_id) && empty($vl_id)) { return $this->asJson([ 'code' => 1, 'msg' => '参数错误' ]); } $query = VideoGoodsVote::find()->alias('vgv')->where(['vgv.store_id' => get_store_id(), 'vgv.is_delete' => 0, 'vgv.is_cancel' => 0]) ->leftJoin(['u' => User::tableName()], 'u.id=vgv.user_id') ->leftJoin(['su' => SaasUser::tableName()], 'su.mobile=u.binding'); if (!empty($user_id)) { $query->andWhere(['vgv.vl_user_id' => $user_id]); } if (!empty($vl_id)) { $query->andWhere(['vgv.vl_id' => $vl_id]); } if (in_array($type, [1, 2, 3])) { $query->andWhere(['vgv.type' => $type]); } if (!empty($name)) { $query->andWhere(['like', 'su.name', $name]); } if (!empty($mobile)) { $query->andWhere(['like', 'su.mobile', $mobile]); } $query->orderBy('vgv.created_at desc')->select( 'vgv.*, su.name vote_user_name, su.mobile vote_user_mobile, su.avatar vote_user_avatar' ); $list = pagination_make($query); return $this->asJson([ 'code' => 0, 'msg' => 'success', 'data' => [ 'data' => $list['list'], 'pageNo' => $list['pageNo'], 'totalCount' => $list['totalCount'], ], ]); } public function actionVideoGoodsShareList() { $form = new VideoGoodsForm(); $form->attributes = post_params(); $res = $form->videoGoodsShareList(); return $this->asJson($res); } }