|
@@ -17,7 +17,7 @@ use app\admin\model\system\RecommendRelation;
|
|
use app\admin\model\system\WebRecommendRelation;
|
|
use app\admin\model\system\WebRecommendRelation;
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Class Lecturer 讲师
|
|
|
|
|
|
+ * Class plan 讲师
|
|
* @package app\admin\model\special
|
|
* @package app\admin\model\special
|
|
*/
|
|
*/
|
|
class Plan extends ModelBasic
|
|
class Plan extends ModelBasic
|
|
@@ -38,19 +38,13 @@ class Plan extends ModelBasic
|
|
$alirs = $alirs === '' ? $alirs : $alirs . '.';
|
|
$alirs = $alirs === '' ? $alirs : $alirs . '.';
|
|
$model = $model->where("{$alirs}is_del", 0);
|
|
$model = $model->where("{$alirs}is_del", 0);
|
|
if (isset($where['is_show']) && $where['is_show'] !== '') $model = $model->where("{$alirs}is_show", $where['is_show']);
|
|
if (isset($where['is_show']) && $where['is_show'] !== '') $model = $model->where("{$alirs}is_show", $where['is_show']);
|
|
- if ($where['title'] && $where['title']) $model = $model->where("{$alirs}lecturer_name", 'LIKE', "%$where[title]%");
|
|
|
|
|
|
+ if ($where['title'] && $where['title']) $model = $model->where("{$alirs}plan_name", 'LIKE', "%$where[title]%");
|
|
$model = $model->order("{$alirs}shelf_time desc");
|
|
$model = $model->order("{$alirs}shelf_time desc");
|
|
return $model;
|
|
return $model;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- public static function getRecommendLecturerList($where, $lecturer)
|
|
|
|
- {
|
|
|
|
- $data = self::setWhere($where)->where('id', 'not in', $lecturer)->page((int)$where['page'], (int)$where['limit'])->select();
|
|
|
|
- $data = count($data) ? $data->toArray() : [];
|
|
|
|
- $count = self::setWhere($where)->where('id', 'not in', $lecturer)->count();
|
|
|
|
- return compact('data', 'count');
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
|
|
public static function setMerWhere($where, $alirs = '', $model = null)
|
|
public static function setMerWhere($where, $alirs = '', $model = null)
|
|
{
|
|
{
|
|
@@ -59,7 +53,7 @@ class Plan extends ModelBasic
|
|
$alirs = $alirs === '' ? $alirs : $alirs . '.';
|
|
$alirs = $alirs === '' ? $alirs : $alirs . '.';
|
|
$model = $model->where("{$alirs}is_del", 0);
|
|
$model = $model->where("{$alirs}is_del", 0);
|
|
if (isset($where['is_show']) && $where['is_show'] !== '') $model = $model->where("{$alirs}is_show", $where['is_show']);
|
|
if (isset($where['is_show']) && $where['is_show'] !== '') $model = $model->where("{$alirs}is_show", $where['is_show']);
|
|
- if ($where['title'] && $where['title']) $model = $model->where("{$alirs}lecturer_name", 'LIKE', "%$where[title]%");
|
|
|
|
|
|
+ if ($where['title'] && $where['title']) $model = $model->where("{$alirs}plan_name", 'LIKE', "%$where[title]%");
|
|
$model = $model->order("{$alirs}sort desc");
|
|
$model = $model->order("{$alirs}sort desc");
|
|
$model = $model->join('Merchant m', 'l.mer_id=m.id', 'left')->field('l.*,m.status,m.is_source');
|
|
$model = $model->join('Merchant m', 'l.mer_id=m.id', 'left')->field('l.*,m.status,m.is_source');
|
|
return $model;
|
|
return $model;
|
|
@@ -70,7 +64,7 @@ class Plan extends ModelBasic
|
|
* @return array
|
|
* @return array
|
|
* @throws \think\Exception
|
|
* @throws \think\Exception
|
|
*/
|
|
*/
|
|
- public static function getLecturerList($where)
|
|
|
|
|
|
+ public static function getplanList($where)
|
|
{
|
|
{
|
|
$data = self::setWhere($where, 'p')->page((int)$where['page'], (int)$where['limit'])->select();
|
|
$data = self::setWhere($where, 'p')->page((int)$where['page'], (int)$where['limit'])->select();
|
|
$data = count($data) ? $data->toArray() : [];
|
|
$data = count($data) ? $data->toArray() : [];
|
|
@@ -89,15 +83,15 @@ class Plan extends ModelBasic
|
|
$plan = self::get($id);
|
|
$plan = self::get($id);
|
|
if (!$plan) return self::setErrorInfo('删除的数据不存在');
|
|
if (!$plan) return self::setErrorInfo('删除的数据不存在');
|
|
// Special::where('is_del', 0)->where('id', $id)->update(['is_show' => 0, 'is_del' => 1]);
|
|
// Special::where('is_del', 0)->where('id', $id)->update(['is_show' => 0, 'is_del' => 1]);
|
|
- // if ($lecturer['mer_id'] > 0) {
|
|
|
|
- // $merchant = Merchant::get($lecturer['mer_id']);
|
|
|
|
|
|
+ // if ($plan['mer_id'] > 0) {
|
|
|
|
+ // $merchant = Merchant::get($plan['mer_id']);
|
|
// if ($merchant) {
|
|
// if ($merchant) {
|
|
- // Merchant::where('id', $lecturer['mer_id'])->update(['is_del' => 1]);
|
|
|
|
|
|
+ // Merchant::where('id', $plan['mer_id'])->update(['is_del' => 1]);
|
|
// User::where('uid', $merchant['uid'])->update(['business' => 0]);
|
|
// User::where('uid', $merchant['uid'])->update(['business' => 0]);
|
|
- // MerchantAdmin::where('mer_id', $lecturer['mer_id'])->update(['is_del' => 1]);
|
|
|
|
- // DownloadModel::where(['is_del' => 0, 'mer_id' => $lecturer['mer_id']])->update(['is_show' => 0, 'is_del' => 1]);
|
|
|
|
- // ProductModel::where(['is_del' => 0, 'mer_id' => $lecturer['mer_id']])->update(['is_show' => 0, 'is_del' => 1]);
|
|
|
|
- // EventRegistrationModel::where(['is_del' => 0, 'mer_id' => $lecturer['mer_id']])->update(['is_show' => 0, 'is_del' => 1]);
|
|
|
|
|
|
+ // MerchantAdmin::where('mer_id', $plan['mer_id'])->update(['is_del' => 1]);
|
|
|
|
+ // DownloadModel::where(['is_del' => 0, 'mer_id' => $plan['mer_id']])->update(['is_show' => 0, 'is_del' => 1]);
|
|
|
|
+ // ProductModel::where(['is_del' => 0, 'mer_id' => $plan['mer_id']])->update(['is_show' => 0, 'is_del' => 1]);
|
|
|
|
+ // EventRegistrationModel::where(['is_del' => 0, 'mer_id' => $plan['mer_id']])->update(['is_show' => 0, 'is_del' => 1]);
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
return self::where('id', $id)->update(['is_del' => 1]);
|
|
return self::where('id', $id)->update(['is_del' => 1]);
|
|
@@ -112,9 +106,9 @@ class Plan extends ModelBasic
|
|
}
|
|
}
|
|
|
|
|
|
/**讲师课程订单
|
|
/**讲师课程订单
|
|
- * @param $lecturer_id
|
|
|
|
|
|
+ * @param $plan_id
|
|
*/
|
|
*/
|
|
- public static function lecturerOrderList($where)
|
|
|
|
|
|
+ public static function planOrderList($where)
|
|
{
|
|
{
|
|
$model = self::getOrderWhere($where)->field('a.order_id,a.pay_price,a.pay_type,a.paid,a.status,a.total_price,a.refund_status,a.type,s.title,r.nickname,a.uid');
|
|
$model = self::getOrderWhere($where)->field('a.order_id,a.pay_price,a.pay_type,a.paid,a.status,a.total_price,a.refund_status,a.type,s.title,r.nickname,a.uid');
|
|
$data = ($data = $model->page((int)$where['page'], (int)$where['limit'])->select()) && count($data) ? $data->toArray() : [];
|
|
$data = ($data = $model->page((int)$where['page'], (int)$where['limit'])->select()) && count($data) ? $data->toArray() : [];
|
|
@@ -170,8 +164,8 @@ class Plan extends ModelBasic
|
|
$model = StoreOrderModel::alias('a')->join('user r', 'r.uid=a.uid', 'LEFT')
|
|
$model = StoreOrderModel::alias('a')->join('user r', 'r.uid=a.uid', 'LEFT')
|
|
->join('Special s', 'a.cart_id=s.id')
|
|
->join('Special s', 'a.cart_id=s.id')
|
|
->where('a.type', 0)->where('a.paid', 1);
|
|
->where('a.type', 0)->where('a.paid', 1);
|
|
- if ($where['lecturer_id']) {
|
|
|
|
- $model = $model->where('s.lecturer_id', $where['lecturer_id']);
|
|
|
|
|
|
+ if ($where['plan_id']) {
|
|
|
|
+ $model = $model->where('s.plan_id', $where['plan_id']);
|
|
}
|
|
}
|
|
if ($where['data'] !== '') {
|
|
if ($where['data'] !== '') {
|
|
$model = self::getModelTime($where, $model, 'a.add_time');
|
|
$model = self::getModelTime($where, $model, 'a.add_time');
|
|
@@ -263,25 +257,4 @@ class Plan extends ModelBasic
|
|
]
|
|
]
|
|
];
|
|
];
|
|
}
|
|
}
|
|
-
|
|
|
|
- /**生成讲师
|
|
|
|
- * @param $data
|
|
|
|
- * @param $mer_id
|
|
|
|
- * @return object
|
|
|
|
- */
|
|
|
|
- public static function addLecturer($data, $mer_id)
|
|
|
|
- {
|
|
|
|
- $array = [
|
|
|
|
- 'mer_id' => $mer_id,
|
|
|
|
- 'lecturer_name' => $data['merchant_name'],
|
|
|
|
- 'lecturer_head' => $data['merchant_head'],
|
|
|
|
- 'phone' => $data['link_tel'],
|
|
|
|
- 'label' => $data['label'],
|
|
|
|
- 'introduction' => $data['introduction'],
|
|
|
|
- 'explain' => $data['explain'],
|
|
|
|
- 'add_time' => time()
|
|
|
|
- ];
|
|
|
|
- $res = self::set($array);
|
|
|
|
- return $res;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|