Browse Source

企业专区改动

master
wanghongjun 2 years ago
parent
commit
5dde50dd96
  1. 4
      addons/weliam_smartcity/api/Store.php
  2. 2
      addons/weliam_smartcity/core/model/Category.mod.php
  3. 66
      addons/weliam_smartcity/core/model/MerchantDataEnt.mod.php
  4. 8
      addons/weliam_smartcity/plugin/recruit/uniapp.php
  5. 39
      addons/weliam_smartcity/web/controller/store/merchant.ctrl.php
  6. 21
      addons/weliam_smartcity/web/view/default/store/userEdit.html
  7. 8
      addons/weliam_smartcity/web/view/default/store/userIndex.html

4
addons/weliam_smartcity/api/Store.php

@ -517,6 +517,8 @@ class StoreModuleUniapp extends Uniapp
$positionRes = Filter::init($position,$_W['source'],1);
if($positionRes['errno'] == 0) $this->renderError('职务'.$positionRes['message']);
}
$validateEntData = MerchantDataEnt::validateEntData($_GPC, $_W['source']);
if ($validateEntData !== true) $this->renderError($validateEntData);
//获取商户数据
$data['realname'] = trim($_GPC['name']);
$data['mobile'] = $_GPC['mobile'];
@ -630,6 +632,7 @@ class StoreModuleUniapp extends Uniapp
}
Member::updateStoreUserIdentity($storeid,1);
MerchantDataEnt::saveData($_GPC,$storeid);
# 判断是否跳转支付页面
$jump_pay = in_array($storestatus['status'],[1,2,3]) ? 0 : 1;
$this->renderSuccess('提交成功' , ['storeid' => $storeid,'jump_pay' => $jump_pay]);
@ -750,6 +753,7 @@ class StoreModuleUniapp extends Uniapp
pdo_insert('wlmerchant_merchantuser', $saledata);
}
}
MerchantDataEnt::saveData($_GPC,$storeid);
$this->renderSuccess('创建企业成功' , $data);
}
}

2
addons/weliam_smartcity/core/model/Category.mod.php

@ -44,7 +44,7 @@ class Category
global $_W;
if (empty($id)) return false;
$where = " parentid = {$id} and uniacid = {$_W['uniacid']} and status = 1";
if ($stint) $where .= " and name != '推荐'";
if ($stint) $where .= " and name not like '%推荐%'";
return pdo_getall(PDO_NAME . self::$tableName , $where,$fields,'','displayorder desc,id desc');
}
/**

66
addons/weliam_smartcity/core/model/MerchantDataEnt.mod.php

@ -2,40 +2,92 @@
defined('IN_IA') or exit('Access Denied');
class MerchantDataEnt
{
/**
* 验证填写合法性
*/
public static function validateEntData($data,$source)
{
try {
if (!empty($data['introduction'])) {
$textRes = Filter::init($data['introduction'],$source);
if ($textRes['errno'] == 0) {
throw new Exception('企业简介'.$textRes['message']);
}
}
if (!empty($data['business'])) {
$textRes = Filter::init($data['business'],$source);
if ($textRes['errno'] == 0) {
throw new Exception('经营业务'.$textRes['message']);
}
}
if (!empty($data['advantage'])) {
$textRes = Filter::init($data['advantage'],$source);
if ($textRes['errno'] == 0) {
throw new Exception('企业优势'.$textRes['message']);
}
}
return true;
} catch (Exception $e) {
return $e->getMessage();
}
}
/**
* 新增编辑企业信息
* @param $data
* @param $storeid
* @return bool
*/
public static function saveData($data,$storeid)
{
$save_data = ['storeid' => $storeid];
if (!empty($data['cc_id'])) {
if (!empty($data['cc_id']) && is_numeric($data['cc_id'])) {
$save_data['cc_id'] = $data['cc_id'];
}
if (!empty($data['introduction'])) {
$save_data['introduction'] = $data['introduction'];
$save_data['introduction'] = htmlspecialchars_decode($data['introduction']);
}
if (!empty($data['business'])) {
$save_data['business'] = $data['business'];
$save_data['business'] = htmlspecialchars_decode($data['business']);
}
if (!empty($data['advantage'])) {
$save_data['advantage'] = $data['advantage'];
$save_data['advantage'] = htmlspecialchars_decode($data['advantage']);
}
if (is_numeric($data['recommend']) && in_array($data['recommend'],[0,1])) {
$save_data['recommend'] = $data['recommend'];
}
$query = pdo_get(PDO_NAME . 'wlmerchant_merchantdataent',['storeid' => $storeid]);
$query = pdo_get(PDO_NAME . 'merchantdataent',['storeid' => $storeid]);
if ($query) {
$save_data['update_time'] = date("Y-m-d H:i:s",time());
pdo_update(PDO_NAME . 'wlmerchant_merchantdataent',$save_data,['id' => $query['id']]);
pdo_update(PDO_NAME . 'merchantdataent',$save_data,['id' => $query['id']]);
} else {
$save_data['create_time'] = date("Y-m-d H:i:s",time());
pdo_insert(PDO_NAME . 'wlmerchant_merchantdataent',$save_data);
pdo_insert(PDO_NAME . 'merchantdataent',$save_data);
}
return true;
}
public static function getStoreEntData($storeid)
{
return pdo_get(PDO_NAME . 'merchantdataent',['storeid' => $storeid]);
}
public static function getStoreIdArr($data)
{
if (empty($data)) return [];
$storeIdArr = [];
$where = [];
if (!empty($data['cc_id'])) $where['cc_id'] = $data['cc_id'];
if (is_numeric($data['recommend'])) $where['recommend'] = $data['recommend'];
$query = pdo_getall(PDO_NAME . 'merchantdataent',$where,['storeid']);
foreach ($query as $row) $storeIdArr[] = $row['storeid'];
return $storeIdArr;
}
}

8
addons/weliam_smartcity/plugin/recruit/uniapp.php

@ -411,6 +411,7 @@ class RecruitModuleUniapp extends Uniapp
$recruitNatureId = $_GPC['recruit_nature_id'] ? : 0;//性质
$recruitIndustryId = $_GPC['recruit_industry_id'] ? : 0;//行业 仅上级行业
$title = $_GPC['title'];// 搜索框搜索
$cc_id = $_GPC['cc_id'];// 分类id
//获取默认排序方式
$set = Setting::agentsetting_read("pluginlist");
$sort = $_GPC['sort'] ? : $set['sjsort'];
@ -431,6 +432,13 @@ class RecruitModuleUniapp extends Uniapp
}
$where .= " and {$a}id in ({$storeIds})";
}
$dataEntWhere = [];
if (!empty($cc_id)) $dataEntWhere['cc_id'] = $cc_id;
if (isset($_GPC['recommend']) && in_array($_GPC['recommend'],[0,1])) $dataEntWhere['recommend'] = $_GPC['recommend'];
if (!empty($dataEntWhere)) {
$storeIdsArr = MerchantDataEnt::getStoreIdArr($dataEntWhere);
$where .= " and {$a}.id in (" . ($storeIdsArr ? implode(",",$storeIdsArr) : '0') . ") ";
}
//生成排序条件 1=创建时间,2=店铺距离,3=默认设置,4=浏览人气
switch ($sort) {
case 1:

39
addons/weliam_smartcity/web/controller/store/merchant.ctrl.php

@ -100,6 +100,16 @@ class Merchant_WeliamController {
//查询店员
$value['clerknum'] = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_merchantuser') . " WHERE storeid = {$value['id']} AND ismain != 1");
$value['groupname'] = $value['groupid'] ? pdo_getcolumn('wlmerchant_chargelist', array('id' => $value['groupid']), 'name') : '';
# 企业附属表数据
$dataEnt = MerchantDataEnt::getStoreEntData($value['id']);
$value['recommend'] = 0;
if ($dataEnt) {
$value['recommend'] = $dataEnt['recommend'];
$categoryRes = pdo_get(PDO_NAME . 'cultivate_class',['id' => $dataEnt['cc_id']],['name']);
if ($categoryRes) {
$value['cc_name'] = $categoryRes['name'];
}
}
}
$pager = $storesData[1];
$status0 = pdo_fetchcolumn('SELECT COUNT(id) FROM ' . tablename(PDO_NAME . 'merchantdata') . " WHERE enabled = 0 and uniacid={$_W['uniacid']} and status=2 and aid={$_W['aid']}");
@ -412,6 +422,7 @@ class Merchant_WeliamController {
if ($noticeflag) {
Member::returnIdentity($oldMid);
}
MerchantDataEnt::saveData($register,$id);
if ($result) {
if (!empty($id)) {
//处理分类
@ -512,6 +523,17 @@ class Merchant_WeliamController {
if(p('housekeep')){
$housekeepcate = Housekeep::getCategory();
}
# 企业分类
$category = Category::getChildCategoryAll(8,'*',true);
$register['cc_id'] = 0;
$register['recommend'] = 0;
if ($id) {
$merchantDataEnt = MerchantDataEnt::getStoreEntData($id);
if ($merchantDataEnt) {
$register['cc_id'] = $merchantDataEnt['cc_id'];
$register['recommend'] = $merchantDataEnt['recommend'];
}
}
include wl_template('store/userEdit');
}
@ -966,5 +988,22 @@ class Merchant_WeliamController {
}
show_json(1, '保存成功');
}
/**
* Comment: 修改推荐状态
* Author: zzw
* Date: 2023/5/6 13:52
*/
public function changeRecommend()
{
global $_W, $_GPC;
#1、获取参数信息
$id = $_GPC['id'] or Commons::sRenderError('缺少参数:导航id');
$recommend = $_GPC['status'] ?: 0;
#1、修改操作
$res = MerchantDataEnt::saveData(['recommend' => $recommend],$id);
if ($res) Commons::sRenderSuccess('修改成功');
else Commons::sRenderError('修改失败,请刷新重试!');
}
}

21
addons/weliam_smartcity/web/view/default/store/userEdit.html

@ -44,6 +44,16 @@
<input type="text" name="register[storename]" required class="form-control" value="{$register['storename']}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">店铺分类<span class="must-fill">*</span></label>
<div class="col-sm-9">
<select name="register[cc_id]" class="form-control">
{loop $category $cateVal}
<option {if $register['cc_id'] == $cateVal['id']}selected{/if} value="{$cateVal['id']}">{$cateVal['name']}</option>
{/loop}
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">店铺描述<span class="must-fill">*</span></label>
<div class="col-sm-9">
@ -279,6 +289,17 @@
</div>
</div>
{/if}
<div class="form-group">
<label class="col-sm-2 control-label">推荐</label>
<div class="col-sm-9">
<label class="radio-inline">
<input type="radio" name="register[recommend]" value="0" {if $register['recommend']==0}checked{/if}>
</label>
<label class="radio-inline">
<input type="radio" name="register[recommend]" value="1" {if $register['recommend']==1}checked{/if}>
</label>
</div>
</div>
{/if}
</div>
</div>

8
addons/weliam_smartcity/web/view/default/store/userIndex.html

@ -104,6 +104,8 @@
<th>账户余额</th>
<th>店长</th>
<th>店员</th>
<th>店铺分类</th>
<th>推荐</th>
<th>所属套餐</th>
<th>时间</th>
<th>状态</th>
@ -132,6 +134,12 @@
<td>
<a href="{php echo web_url('store/merchant/clerkindex',array('storeid'=>$user['id']))}">{$user['clerknum']}</a>
</td>
<td>
{if $user['cc_name']}<label class="label label-primary">{$user['cc_name']}</label>{/if}
</td>
<td>
{php echo tpl_change_status('store/merchant/changeRecommend&id='.$user['id'],$user['recommend'])}
</td>
<td class="text-left">
{if $user['groupname']}<label class="label label-success">{$user['groupname']}</label>{/if}
</td>

Loading…
Cancel
Save