activity_1020
This commit is contained in:
@@ -57,8 +57,9 @@ class Activity extends BaseController
|
||||
$dateRange = [$v['timeStart'], $v['timeEnd']];
|
||||
$status = intval($v['status']);
|
||||
$activityId = intval($v['activityId']);
|
||||
$bgImg = $channelImg = $sharePhoto = $shareImg = $shareTitle = $bizIds = [];
|
||||
$bgImg = $channelImg = $sharePhoto = $shareImg = $shareTitle = $bizIds = $pay = [];
|
||||
$item = ['activityId' => $activityId, 'itemImg' => [], 'title' => '', 'introduction' => '', 'price' => '', 'dateRange' => ''];
|
||||
$pay = ['way' => 1, 'price' => '', 'img' => []];
|
||||
$v['shareTitle'] && $shareTitle = json_decode($v['shareTitle'], true);
|
||||
$jsondata = $v['jsondata'] ? json_decode($v['jsondata'], true) : [];
|
||||
if ($jsondata['item']) {
|
||||
@@ -76,6 +77,15 @@ class Activity extends BaseController
|
||||
$item['itemImg'] = $itemImg;
|
||||
}
|
||||
}
|
||||
if (intval($jsondata['pay']['way']) > 1) {
|
||||
$pay = $jsondata['pay'];
|
||||
if ($pay['img']) {
|
||||
$img[] = ['uid' => 1, 'fileUrl' => $pay['img'], 'url' => build_qiniu_image_url($pay['img']), 'status' => 'done'];
|
||||
$pay['img'] = $img;
|
||||
} else {
|
||||
$pay['img'] = [];
|
||||
}
|
||||
}
|
||||
if ($v['bgImg']) {
|
||||
$bgImg = [['uid' => 1, 'fileUrl' => $v['bgImg'], 'url' => build_qiniu_image_url($v['bgImg']), 'status' => 'done']];
|
||||
}
|
||||
@@ -101,7 +111,7 @@ class Activity extends BaseController
|
||||
$url = http_host_com('home') . "/h5/market/sylive?skey=" . $skey;//活动连接
|
||||
$urlItem = http_host_com('home') . "/h5/market/sylive/act/item?skey=" . $skey;//商品连接
|
||||
$list[] = [
|
||||
'activityId' => $activityId, 'title' => $v['title'], 'channelId' => $v['channelId'], 'bizIds' => $bizIds,
|
||||
'activityId' => $activityId, 'title' => $v['title'], 'channelId' => $v['channelId'], 'bizIds' => $bizIds, 'pay' => $pay,
|
||||
'introduction' => $v['introduction'], 'shareTitle' => $shareTitle, 'dateRange' => $dateRange, 'urlItem' => $urlItem
|
||||
, 'bgImg' => $bgImg, 'channelImg' => $channelImg, 'sharePhoto' => $sharePhoto, 'shareImg' => $shareImg, 'item' => $item, 'url' => $url
|
||||
, 's_time' => $v['timeStart'], 'e_time' => $v['timeEnd'], 'status' => $status, 'createTime' => $v['createTime']];
|
||||
@@ -128,6 +138,7 @@ class Activity extends BaseController
|
||||
$channelImg = $this->input_param('channelImg');
|
||||
$sharePhoto = $this->input_param('sharePhoto');
|
||||
$bizIds = $this->input_param('bizIds');
|
||||
$pay = $this->input_param('pay');
|
||||
if (!$title) {
|
||||
$this->return_json('请输入活动标题');
|
||||
}
|
||||
@@ -157,7 +168,14 @@ class Activity extends BaseController
|
||||
}
|
||||
$setShareImg = json_encode($setShareImg, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
$addDate = ['title' => $title, 'bgImg' => $bgImg, 'channelImg' => $channelImg, 'channelId' => $channelId
|
||||
if ($pay['way'] > 1) {
|
||||
$pay['img'] = $pay['img'][0]['fileUrl'] ? $pay['img'][0]['fileUrl'] : '';
|
||||
} else {
|
||||
$pay = ['way' => 1, 'price' => '', 'img' => []];
|
||||
}
|
||||
$jsondata['pay'] = $pay;
|
||||
$jsondata = json_encode($jsondata, JSON_UNESCAPED_UNICODE);
|
||||
$addDate = ['title' => $title, 'bgImg' => $bgImg, 'channelImg' => $channelImg, 'channelId' => $channelId, 'jsondata' => $jsondata
|
||||
, 'introduction' => $introduction, 'shareTitle' => $shareTitle, 'sharePhoto' => $sharePhoto, 'shareImg' => $setShareImg
|
||||
, 'timeStart' => $dateRange[0], 'timeEnd' => $dateRange[1], 'status' => 1, 'createTime' => date('Y-m-d H:i:s')];
|
||||
$activityId = $this->mdSyliveActivity->add($addDate);
|
||||
@@ -216,6 +234,7 @@ class Activity extends BaseController
|
||||
$channelImg = $this->input_param('channelImg');
|
||||
$sharePhoto = $this->input_param('sharePhoto');
|
||||
$bizIds = $this->input_param('bizIds');
|
||||
$pay = $this->input_param('pay');
|
||||
if (!$activityId) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
@@ -237,6 +256,10 @@ class Activity extends BaseController
|
||||
// if (!$introduction) {
|
||||
// $this->return_json('请输入活动简介');
|
||||
// }
|
||||
$re = $this->mdSyliveActivity->get(['activityId' => $activityId]);
|
||||
if (!$re) {
|
||||
$this->return_json('活动不存在');
|
||||
}
|
||||
$bizIds = implode(',', $bizIds);
|
||||
$res_org = $this->mdSyliveOrganization->select(["organizationId in({$bizIds})" => null, 'organizationType' => 3]
|
||||
, 'organizationId desc', 0, 0, 'organizationId,parentId');
|
||||
@@ -266,8 +289,17 @@ class Activity extends BaseController
|
||||
}
|
||||
$setShareImg = json_encode($setShareImg, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
$jsondata = $re['jsondata'] ? json_decode($re['jsondata'], true) : [];
|
||||
if ($pay['way'] > 1) {
|
||||
$pay['img'] = $pay['img'][0]['fileUrl'] ? $pay['img'][0]['fileUrl'] : '';
|
||||
} else {
|
||||
$pay = ['way' => 1, 'price' => '', 'img' => []];
|
||||
}
|
||||
$jsondata['pay'] = $pay;
|
||||
$jsondata = json_encode($jsondata, JSON_UNESCAPED_UNICODE);
|
||||
$upDate = ['title' => $title, 'bgImg' => $bgImg, 'channelImg' => $channelImg, 'channelId' => $channelId, 'introduction' => $introduction,
|
||||
'shareTitle' => $shareTitle, 'sharePhoto' => $sharePhoto, 'shareImg' => $setShareImg, 'timeStart' => $dateRange[0], 'timeEnd' => $dateRange[1]];
|
||||
'shareTitle' => $shareTitle, 'sharePhoto' => $sharePhoto, 'shareImg' => $setShareImg, 'jsondata' => $jsondata,
|
||||
'timeStart' => $dateRange[0], 'timeEnd' => $dateRange[1]];
|
||||
$this->mdSyliveActivity->update($upDate, ['activityId' => $activityId]);
|
||||
$this->return_response();
|
||||
}
|
||||
@@ -695,9 +727,11 @@ class Activity extends BaseController
|
||||
foreach ($res as $v) {
|
||||
$consultant = $this->consultantGet(['a_id' => $v['item_id'], 'uid' => $v['uid']]);
|
||||
$list[] = [
|
||||
'id' => $v['id'], 'consultant' => $consultant, 'uname' => $v['uname'], 'mobile' => $v['mobile'], 'item_title' => $v['item_title']
|
||||
'id' => $v['id'], 'uname' => $v['uname'], 'mobile' => $v['mobile'], 'item_title' => $v['item_title']
|
||||
, 'total_price' => $v['total_price'], 'pay_time' => $v['pay_time'] != '0000-00-00 00:00:00' ? $v['pay_time'] : ''
|
||||
, 'statusName' => $this->mdSyliveOrder->statusAry($v['status']), 'createTime' => $v['createTime']];
|
||||
, 'statusName' => $this->mdSyliveOrder->statusAry($v['status']), 'createTime' => $v['createTime']
|
||||
, 'area' => $consultant['area'], 'stores' => $consultant['stores'], 'consultant' => $consultant['consultant']
|
||||
];
|
||||
}
|
||||
}
|
||||
if ($limit == 10000) {
|
||||
@@ -716,17 +750,17 @@ class Activity extends BaseController
|
||||
*/
|
||||
private function consultantGet($params)
|
||||
{
|
||||
$title = '';
|
||||
$area = $stores = $consultant = '';
|
||||
$re = $this->mdSyliveActivityKpidata->get(['a_id' => $params['a_id'], 'uid' => $params['uid'], 'kpi' => 'order']);
|
||||
if ($re['cf_uid']) {
|
||||
$re_user = $this->mdSyliveUser->get(['userId' => $re['cf_uid']]);
|
||||
$res_orga = $this->mdSyliveOrganization->get(["organizationId" => $re['area_id']]);
|
||||
$res_orgb = $this->mdSyliveOrganization->get(["organizationId" => $re['biz_id']]);
|
||||
$res_orga && $title = $res_orga['organizationName'];
|
||||
$res_orgb && $title = $title ? $title . '-' . $res_orgb['organizationName'] : $res_orgb['organizationName'];
|
||||
$re_user && $title = $title ? $title . '-' . $re_user['uname'] : $re_user['uname'];
|
||||
$re_user = $this->mdSyliveUser->get(['userId' => $re['cf_uid']]);
|
||||
$res_orga['organizationName'] && $area = $res_orga['organizationName'];
|
||||
$res_orgb['organizationName'] && $stores = $res_orgb['organizationName'];
|
||||
$re_user['uname'] && $consultant = $re_user['uname'];
|
||||
}
|
||||
return $title;
|
||||
return ['area' => $area, 'stores' => $stores, 'consultant' => $consultant];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -82,6 +82,12 @@ class Organization extends BaseController
|
||||
if (!$organizationType) {
|
||||
$this->return_json('请选择机构类型');
|
||||
}
|
||||
if ($parentId) {//判断上级机构是不是员工类型
|
||||
$re_org = $this->mdSyliveOrganization->get(['organizationId' => $parentId]);
|
||||
if ($re_org['organizationType'] == 4) {
|
||||
$this->return_json('选择的上级机构不能保存,请重新选择');
|
||||
}
|
||||
}
|
||||
!$comments && $comments = '';
|
||||
$addDate = ['parentId' => $parentId, 'organizationName' => $organizationName, 'organizationFullName' => $organizationFullName
|
||||
, 'organizationType' => $organizationType, 'sortNumber' => $sortNumber, 'comments' => $comments
|
||||
@@ -129,6 +135,12 @@ class Organization extends BaseController
|
||||
if (!$organizationType) {
|
||||
$this->return_json('请选择机构类型');
|
||||
}
|
||||
if ($parentId) {//判断上级机构是不是员工类型
|
||||
$re_org = $this->mdSyliveOrganization->get(['organizationId' => $parentId]);
|
||||
if ($re_org['organizationType'] == 4) {
|
||||
$this->return_json('选择的上级机构不能保存,请重新选择');
|
||||
}
|
||||
}
|
||||
!$comments && $comments = '';
|
||||
$upDate = ['parentId' => $parentId, 'organizationName' => $organizationName, 'organizationFullName' => $organizationFullName
|
||||
, 'organizationType' => $organizationType, 'sortNumber' => $sortNumber, 'comments' => $comments];
|
||||
|
||||
Reference in New Issue
Block a user