market_draw_1215

This commit is contained in:
dengbw
2022-12-15 15:35:11 +08:00
parent 62bd5338ac
commit 0dd8779612
4 changed files with 299 additions and 6 deletions
@@ -133,8 +133,8 @@ class Market_sylive_order_model extends HD_Model
$bgImg = 'https://qs.haodian.cn/web/images/project/H5-ShiYu-draw/bg.png?v=20221110';
} else if ($activityId == 6) {
$winNumAry = [['title' => '请选择中奖人数', 'value' => 0],
['title' => '1人', 'value' => 1], ['title' => '20人', 'value' => 20],
['title' => '50人', 'value' => 50]];
['title' => '1人', 'value' => 1], ['title' => '20人', 'value' => 20], ['title' => '30人', 'value' => 30],
['title' => '40人', 'value' => 40], ['title' => '50人', 'value' => 50]];
$bgImg = 'https://qs.haodian.cn/web/images/project/H5-ShiYu-draw/bg-20221213.png?v=20221214';
}
$data = ['winNumAry' => $winNumAry, 'bgImg' => $bgImg];
+42 -3
View File
@@ -6,7 +6,7 @@
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>私域直播抽奖</title>
<link rel="stylesheet" href="/css/h5/market/draw/pc.css?20221214">
<link rel="stylesheet" href="/css/h5/market/draw/pc.css?20221216">
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/jquery.3.4.1.min.js"></script>
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/vue.2.6.10.min.js"></script>
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/mDialog.js"></script>
@@ -57,6 +57,19 @@
</div>
</div>
</div>
<div class="absolute box-center-middle" style="width:50%;" v-else-if="winNum==10">
<div class="fn-flex fn-flex-wrap">
<div class="wp50 relative" style="height:100px;" v-if="index<winNum"
v-for="(item,index) in list">
<img class="absolute box-middle left-0 ml50 imgsize-60X60 ulib-r750" :src="item.headimg"
alt="#"/>
<div class="absolute box-middle left-0 right-0 pl130">
<div class="text-nowrap font-18">{{item.name}}</div>
<div class="font-14 color-666">{{item.tel}}</div>
</div>
</div>
</div>
</div>
<div class="absolute box-center-middle" style="width:100%;" v-else-if="winNum==20">
<div class="fn-flex fn-flex-wrap">
<div class="wp25 relative" style="height:100px;" v-if="index<winNum"
@@ -70,12 +83,38 @@
</div>
</div>
</div>
<div class="absolute box-center-middle" style="width:100%;" v-else-if="winNum==30">
<div class="fn-flex fn-flex-wrap">
<div class="wp20 relative" style="height:90px;" v-if="index<winNum"
v-for="(item,index) in list">
<img class="absolute box-middle left-0 ml50 imgsize-60X60 ulib-r750" :src="item.headimg"
alt="#"/>
<div class="absolute box-middle left-0 right-0 pl130">
<div class="text-nowrap font-18">{{item.name}}</div>
<div class="font-14 color-666">{{item.tel}}</div>
</div>
</div>
</div>
</div>
<div class="absolute box-center-middle" style="width:100%;" v-else-if="winNum==40">
<div class="fn-flex fn-flex-wrap">
<div class="wp20 relative" style="height:70px;" v-if="index<winNum"
v-for="(item,index) in list">
<img class="absolute box-middle left-0 ml50 imgsize-45X45 ulib-r750" :src="item.headimg"
alt="#"/>
<div class="absolute box-middle left-0 right-0 pl110">
<div class="text-nowrap font-16">{{item.name}}</div>
<div class="font-12 color-666">{{item.tel}}</div>
</div>
</div>
</div>
</div>
<div class="fn-flex fn-flex-wrap roll-50-1" v-else>
<div class="wp20 relative" style="height:56px;" v-if="index<winNum"
v-for="(item,index) in list">
<img class="absolute box-middle left-0 ml50 imgsize-30X30 ulib-r750" :src="item.headimg"
<img class="absolute box-middle left-0 ml50 imgsize-36X36 ulib-r750" :src="item.headimg"
alt="#"/>
<div class="absolute box-middle left-0 right-0 pl90">
<div class="absolute box-middle left-0 right-0 pl95">
<div class="text-nowrap font-14">{{item.name}}</div>
<div class="font-12 color-666">{{item.tel}}</div>
</div>
+254
View File
@@ -0,0 +1,254 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
* Notes:私域直播_用户管理
* Created on: 2022/9/19 17:15
* Created by: dengbw
*/
class Members extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('market/Market_sylive_user_model', 'mdSyliveUser');
$this->load->model('market/Market_sylive_organization_model', 'mdSyliveOrganization');
}
/**
* Notes:用户管理列表
* Created on: 2022/9/20 14:48
* Created by: dengbw
*/
public function page_get()
{
$page = $this->input_param('page');
$limit = $this->input_param('limit');
$uname = $this->input_param('uname');
$nickname = $this->input_param('nickname');
$sort = $this->input_param('sort');
$order = $this->input_param('order');
$organizationId = intval($this->input_param('organizationId'));
$topOrgId = intval($this->input_param('topOrgId'));
$keyWord = $this->input_param('keyWord');
!$page && $page = 1;
!$limit && $limit = 10;
$sort_order = 'userId desc';
if ($sort && $order) {
$sort_order = $sort . ' ' . $order;
}
$list = $re_org = [];
$organizationType = 0;
$roleAry = $this->mdSyliveUser->roleAry();
$where['status>='] = 0;
if ($organizationId) {
$where['organizationId'] = $organizationId;
$re_org = $this->mdSyliveOrganization->get(['organizationId' => $organizationId]);
}
if ($topOrgId) {
$where['topOrgId'] = $topOrgId;
$re_org = $this->mdSyliveOrganization->get(['organizationId' => $topOrgId]);
}
$re_org && $organizationType = $re_org['organizationType'];
if ($keyWord) {
$where["(uname LIKE '%{$keyWord}%' OR mobile LIKE '%{$keyWord}%') OR nickname LIKE '%{$keyWord}%')"] = null;
} else {
$uname && $where['uname'] = $uname;
$nickname && $where['nickname'] = $nickname;
}
$count = $this->mdSyliveUser->count($where);
if ($count) {
$res = $this->mdSyliveUser->select($where, $sort_order, $page, $limit);
foreach ($res as $v) {
$status = intval($v['status']);
$createTime = $v['createTime'] != '0000-00-00 00:00:00' ? $v['createTime'] : '';
$roleName = $roleAry[$organizationType] ? $roleAry[$organizationType] : '客户';
$list[] = [
'userId' => $v['userId'], 'uname' => $v['uname'], 'nickname' => $v['nickname'], 'mobile' => $v['mobile']
, 'roleName' => $roleName, 'organizationId' => $organizationId, 'status' => $status, 'createTime' => $createTime];
}
}
$date = ['list' => $list, 'count' => $count];
$this->return_response_list($date);
}
/**
* Notes:添加用户
* Created on: 2022/9/21 16:46
* Created by: dengbw
*/
public function index_post()
{
$mobile = $this->input_param('mobile');
$organizationId = intval($this->input_param('organizationId'));
$uname = $this->input_param('uname');
if (!$mobile) {
$this->return_json('请输入手机号');
}
if (!$organizationId) {
$this->return_json('请选择所属机构');
}
if (!$uname) {
$this->return_json('请输入姓名');
}
$topOrgId = $this->getTopOrgId($organizationId);
$re = $this->mdSyliveUser->get(['mobile' => $mobile, 'topOrgId' => $topOrgId]);
if ($re && $re['status'] != -1) {
if ($re['teamId'] || $re['organizationId']) {
$this->return_json('手机号已存在当前机构');
}
}
$bizId = 0;
$re_org = $this->mdSyliveOrganization->get(['organizationId' => $organizationId]);
if ($re_org) {
if ($re_org['organizationType'] == 4 && $re_org['parentId']) {
$bizId = $re_org['parentId'];
} else if ($re_org['organizationType'] == 3) {
$bizId = $re_org['organizationId'];
}
}
$addDate = ['topOrgId' => $topOrgId, 'organizationId' => $organizationId, 'uname' => $uname,
'bizId' => $bizId, 'status' => 0, 'teamId' => 0];
if ($re['userId']) {
$this->mdSyliveUser->update($addDate, ['userId' => $re['userId']]);
$this->return_response([], '绑定用户成功');
} else {
$addDate['mobile'] = $mobile;
$addDate['createTime'] = date('Y-m-d H:i:s');
$id = $this->mdSyliveUser->add($addDate);
if (!$id) {
$this->return_json('添加用户失败');
}
$this->return_response();
}
}
/**
* Notes:修改用户
* Created on: 2022/9/21 14:48
* Created by: dengbw
*/
public function index_put()
{
$userId = intval($this->input_param('userId'));
$organizationId = intval($this->input_param('organizationId'));
$uname = $this->input_param('uname');
if (!$userId) {
$this->return_json('参数错误');
}
if (!$organizationId) {
$this->return_json('请选择所属机构');
}
if (!$uname) {
$this->return_json('请输入姓名');
}
$re = $this->mdSyliveUser->get(['userId' => $userId]);
if (!$re) {
$this->return_json('无此用户');
}
$topOrgId = $re['topOrgId'];
if ($re['organizationId'] != $organizationId) {
$topOrgId = $this->getTopOrgId($organizationId);
if ($re['topOrgId'] && $re['topOrgId'] != $topOrgId) {
$this->return_json('不可修改顶级机构');
}
}
$bizId = 0;
$re_org = $this->mdSyliveOrganization->get(['organizationId' => $organizationId]);
if ($re_org) {
if ($re_org['organizationType'] == 4 && $re_org['parentId']) {
$bizId = $re_org['parentId'];
} else if ($re_org['organizationType'] == 3) {
$bizId = $re_org['organizationId'];
}
}
$upDate = ['topOrgId' => $topOrgId, 'organizationId' => $organizationId, 'bizId' => $bizId, 'teamId' => 0, 'uname' => $uname];
$this->mdSyliveUser->update($upDate, ['userId' => $userId]);
$this->return_response();
}
/**
* Notes:修改状态
* Created on: 2022/9/21 16:10
* Created by: dengbw
*/
public function status_put()
{
$userId = $this->input_param('userId');
$status = $this->input_param('status');
if (!$userId) {
$this->return_json('参数错误');
}
$this->mdSyliveUser->update(['status' => $status], ['userId' => $userId]);
$this->return_response();
}
/**
* Notes:删除用户
* Created on: 2022/9/21 16:10
* Created by: dengbw
* @param null $userId
*/
public function index_delete($userId = null)
{
if (!$userId) {
$this->return_json('参数错误');
}
$this->mdSyliveUser->update(['status' => -1], ['userId' => $userId]);
$this->return_response();
}
/**
* Notes:栓验字段
* Created on: 2022/9/21 15:52
* Created by: dengbw
*/
public function existence_get()
{
$field = $this->input_param('field');
$value = $this->input_param('value');
$organizationId = intval($this->input_param('organizationId'));
if ($organizationId) {
$topOrgId = $this->getTopOrgId($organizationId);
$where = [$field => $value, 'topOrgId' => $topOrgId, 'status>=' => 0];
$re = $this->mdSyliveUser->get($where);
if ($re) {
if ($field == 'mobile') {
if ($re['teamId'] || $re['organizationId']) {
$this->return_json('已存在', 0);
}
} else {
$this->return_json('已存在', 0);
}
}
}
$this->return_json('不存在', 1);
}
/**
* Notes:获取顶级机构id
* Created on: 2022/12/8 14:39
* Created by: dengbw
* @param $organizationId
* @param $topOrgId
* @return mixed
*/
private function getTopOrgId($organizationId, $topOrgId = 0)
{
$re = $this->mdSyliveOrganization->get(['organizationId' => $organizationId], 'organizationId,parentId');
if (!$re) {
return $topOrgId;
} else {
$topOrgId = $re['organizationId'];
if ($re['parentId']) {
return $this->getTopOrgId($re['parentId'], $topOrgId);
} else {
return $topOrgId;
}
}
}
}
File diff suppressed because one or more lines are too long