初始化代码
This commit is contained in:
252
app/publics/controller/SomeThing.php
Normal file
252
app/publics/controller/SomeThing.php
Normal file
@@ -0,0 +1,252 @@
|
||||
<?php
|
||||
namespace app\publics\controller;
|
||||
use app\AdminRest;
|
||||
use app\ApiRest;
|
||||
|
||||
use app\card\model\Job;
|
||||
use app\dynamic\model\CardUser;
|
||||
use app\dynamic\model\UserInfo;
|
||||
use app\publics\model\TmplConfig;
|
||||
use app\shop\model\AdminCompany;
|
||||
use app\shop\model\AdminGoods;
|
||||
use app\shop\model\AdminShopSpe;
|
||||
use app\shop\model\AdminShopSpePrice;
|
||||
use app\shop\model\AdminShopType;
|
||||
use app\shop\model\Goods;
|
||||
use app\shop\model\GoodsSpe;
|
||||
use app\shop\model\GoodsSpePrice;
|
||||
use longbingcore\wxcore\WxTmpl;
|
||||
use think\App;
|
||||
|
||||
|
||||
class SomeThing extends AdminRest
|
||||
{
|
||||
|
||||
protected $model;
|
||||
public function __construct(App $app) {
|
||||
parent::__construct($app);
|
||||
// $this->type_model = new AdminShopType();
|
||||
// $this->company_model = new AdminCompany();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2019-12-26 15:40
|
||||
* @功能说明: 获取模版消息
|
||||
*/
|
||||
public function getCompany(){
|
||||
$dis[] = ['status' ,'=',1];
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
$data = $this->company_model->companySelect($dis);
|
||||
return $this->success($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* User: chenniang
|
||||
* Date: 2019-11-29 17:28
|
||||
* @return void
|
||||
* descption:获取员工
|
||||
*/
|
||||
public function getStaffInfo(){
|
||||
$input = $this->_input;
|
||||
$user_model = new UserInfo();
|
||||
$user_info = new CardUser();
|
||||
// $data = [];
|
||||
$dis[] = ['is_staff','=',1];
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
if(!empty($input['name'])){
|
||||
$dis[] = ['name','like',"%".$input['name']."%"];
|
||||
}
|
||||
$data = $user_model->where($dis)->field('fans_id as id,name')->select();
|
||||
if(!empty($data)){
|
||||
foreach ($data as &$v){
|
||||
if(empty($v['name'])){
|
||||
$v['name'] = $user_info->where(['id'=>$v['id']])->value('nickName');
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->success($data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-05-18 16:29
|
||||
* @功能说明:职位列表
|
||||
*/
|
||||
public function jobList(){
|
||||
|
||||
$job_model = new Job();
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = !empty($input['status'])?['status','>',0]:['status','>',-1];
|
||||
|
||||
$list = $job_model->where($dis)->order('top desc')->field('id,name')->select();
|
||||
|
||||
return $this->success($list);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-03 15:16
|
||||
* @功能说明:获取平台所有的用户
|
||||
*/
|
||||
public function getAllUser(){
|
||||
|
||||
$user_info = new CardUser();
|
||||
|
||||
$dis = [
|
||||
|
||||
'uniacid' => $this->_uniacid
|
||||
|
||||
];
|
||||
//只查id和昵称,一般用于下拉框
|
||||
$data = $user_info->where($dis)->field('id,nickName')->select()->toArray();
|
||||
|
||||
return $this->success($data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-12-08 13:47
|
||||
* @功能说明:商品列表
|
||||
*/
|
||||
public function goodsSelect(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$goods_model = new Goods();
|
||||
|
||||
$spe_price_model = new GoodsSpePrice();
|
||||
|
||||
$dis[] = ['status','=',1];
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
if(!empty($input['title'])){
|
||||
|
||||
$dis[] = ['name','like','%'.$input['title'].'%'];
|
||||
}
|
||||
|
||||
$data = $goods_model->where($dis)->order('top desc,id desc')->paginate($input['limit'])->toArray();
|
||||
|
||||
if(!empty($data['data'])){
|
||||
|
||||
foreach ($data['data'] as &$v){
|
||||
//总库存
|
||||
$v['stock'] = $spe_price_model->getGoodsStock($v['id']);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $goods_id
|
||||
* @功能说明:商品规格
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-01-19 14:26
|
||||
*/
|
||||
public function goodsSpeList(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$spe_model = new GoodsSpe();
|
||||
|
||||
$spe_price_model = new GoodsSpePrice();
|
||||
|
||||
$goods_id = $input['goods_id'];
|
||||
|
||||
$dis['goods_id'] = $goods_id;
|
||||
|
||||
$dis['status'] = 1;
|
||||
|
||||
$data['text'] = $spe_model->goodsSpe($dis);
|
||||
|
||||
$data['price'] = $spe_price_model->goodsSpePrice($dis);
|
||||
|
||||
if(!empty($data['price'])){
|
||||
|
||||
foreach ($data['price'] as &$v){
|
||||
|
||||
$v['title'] = $v['spe_name_text'];
|
||||
|
||||
$v['true_id'] = $v['id'];
|
||||
|
||||
$v['id'] = implode(',',$v['spe_array_text']);
|
||||
|
||||
}
|
||||
}
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-01-30 11:00
|
||||
* @功能说明:获取商品规格
|
||||
*/
|
||||
public function getSpePrice(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['goods_id','=',$input['goods_id']];
|
||||
|
||||
$dis[] = ['status','>',-1];
|
||||
|
||||
$spe_price_model = new AdminShopSpePrice();
|
||||
|
||||
$data = $spe_price_model->goodsSpePrice($dis);
|
||||
|
||||
if(!empty($data)){
|
||||
|
||||
foreach ($data as &$v){
|
||||
|
||||
$v['spe_content'] = $v['spe_name_text'].':'.$v['price'];
|
||||
|
||||
$v['spe_price_id']= $v['id'];
|
||||
}
|
||||
}
|
||||
return $this->success($data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2022-02-22 17:11
|
||||
* @功能说明:生成二维码
|
||||
*/
|
||||
public function getQr(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$uniacid = $this->_uniacid;
|
||||
|
||||
$data = longbingCreateWxCode($uniacid,$input,$input['page']);
|
||||
|
||||
$data = transImagesOne($data ,['qr_path'] ,$uniacid);
|
||||
|
||||
$qr = $data['qr_path'];
|
||||
|
||||
return $qr;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user