Commit 9e25e2f4 by 庄钊鑫

用户授权记录

parent 1e108f91
<?php
namespace app\api\controller\v1\app;
use app\api\logic\app\EngineerLogic;
use app\api\logic\app\ProductLogic;
use app\api\model\About;
use app\api\model\EngineerFeedback;
use app\api\model\EngineerSms;
use app\api\model\UserToken;
use app\common\tools\Wxmini;
use app\api\model\User as UserModel;
use app\api\model\UserSms;
use app\api\logic\app\UserLogic;
use app\api\logic\app\SendLogic;
class Engineer extends Base
{
public $restMethodList = 'get|post|put';
/**
* User: zhaoxin
* Date: 2019-09-19
* Time: 16:19
* description
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function login()
{
$requestData = $this->selectParam(['mobile', 'password']);
$this->check($requestData, 'Base.app_login');
$data = \app\api\model\Engineer::build()->login($requestData);
if ($data) {
$this->render($data,200);
} else {
ResponseDirect(12010);//账号密码错误
}
}
/**
* User: zhaoxin
* Date: 2019-09-19
* Time: 14:15
* description 注册
*/
public function save()
{
$requestData = $this->selectParam([
'mobile', 'password', 'sms_type' => 'pass', 'code' => '111111', 'oauth_uuid' => '',
'service_type','name','province','city','county','service_day' => [],'service_time' => [],'service_skill' => [],
'id_img_one','id_img_two','other_img' => [],'number' => ''
]);
$this->check($requestData, 'Engineer.register');
$bool = SendLogic::validateCode($requestData);
if ($bool === false && empty($requestData['oauth_uuid'])) {
ResponseDirect(11003);//验证码错误
}
$sms_type = $requestData['sms_type'];
unset($requestData['sms_type']);
unset($requestData['code']);
$requestData['is_perfect'] = '1';
$data = \app\api\model\Engineer::build()->register($requestData,'1','');
if ($data){
EngineerSms::build()->update(['is_effected' => 0], ['mobile' => $requestData['mobile'], 'sms_type' => $sms_type,'is_effected' => 1]);
$this->render('注册成功',200);
}else{
ResponseDirect(13001);//注册失败
}
}
/**
* User: zhaoxin
* Date: 2019-09-27
* Time: 15:26
* description
* @param $id
*/
public function update($id){
$user = $this->validateToken();
$requestData = $this->selectParam([
'mobile',
'service_type','name','province','city','county','service_day' => [],'service_time' => [],'service_skill' => [],
'id_img_one','id_img_two','other_img' => [],'number' => ''
]);
$this->check($requestData, 'Engineer.app_update');
$data = \app\api\model\Engineer::build()->updateInfo($requestData,$id);
if ($data){
$this->render('编辑成功',200);
}else{
ResponseDirect(13018);
}
}
public function changeImage(){
$user = $this->validateToken();
$requestData = $this->selectParam([
'img'
]);
$this->check($requestData, 'Engineer.img');
$data = \app\api\model\Engineer::build()
->where(['uuid' => $user['uuid']])
->update(['avatar' => $requestData['img'],'update_time' => timeToDate()]);
if ($data){
$this->render('编辑成功',200);
}else{
ResponseDirect(13018);
}
}
/**
* User: zhaoxin
* Date: 2019-09-19
* Time: 17:58
* description 小程序授权
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function oauth(){
$requestData = $this->selectParam(['jscode' => '','encryptedData'=>'','vi'=>'']);
if(empty($requestData['jscode']) || empty($requestData['encryptedData']) || empty($requestData['vi'])){
ResponseDirect(10001);
}
$data = EngineerLogic::oauth($requestData);
if($data){
$this->render($data);
}else{
ResponseDirect(13002);
}
}
/**
* User: zhaoxin
* Date: 2019-09-20
* Time: 10:00
* description 绑定手机号
* @throws \think\Exception
*/
public function bandMobile(){
$requestData = $this->selectParam(['jscode' => '','encryptedData'=>'','vi'=>'','oauth_uuid']);
if(empty($requestData['jscode']) || empty($requestData['encryptedData']) || empty($requestData['vi'])){
ResponseDirect(10001);
}
$data = EngineerLogic::bandMobile($requestData);
if($data){
$this->render($data);
}else{
ResponseDirect(13004);
}
}
/**
* User: zhaoxin
* Date: 2019-09-20
* Time: 11:11
* description 验证验证码
*/
public function checkCode(){
$requestData = $this->selectParam([
'mobile' => '', 'sms_type' => 'must', 'code' => ''
]);
$this->check($requestData,['mobile' => 'require','sms_type' => 'require','code' => 'require']);
$bool = SendLogic::validateCode($requestData);
if ($bool === false) {
ResponseDirect(11003);//验证码错误
}
$this->render('验证成功');
}
/**
* User: zhaoxin
* Date: 2019-09-20
* Time: 11:17
* description 重置密码
* @throws \think\Exception
*/
public function resetPassword(){
$requestData = $this->selectParam([
'mobile', 'password', 'sms_type' => 'must', 'code' => '','oauth_uuid' => ''
]);
$this->check($requestData, 'Engineer.reset_password');
$bool = SendLogic::validateCode($requestData);
if ($bool === false) {
ResponseDirect(11003);//验证码错误
}
$data = EngineerLogic::resetPassword($requestData);
if($data == false){
ResponseDirect(13009);//验证码错误
}
EngineerSms::build()->update(['is_effected' => 0], ['mobile' => $requestData['mobile'], 'sms_type' => $requestData['sms_type'],'is_effected' => 1]);
$this->render('重置密码成功');
}
/**
* User: zhaoxin
* Date: 2019-09-20
* Time: 14:46
* description 个人信息
*/
public function index(){
$user_info = $this->validateToken();
$data = EngineerLogic::index($user_info);
if($data == false){
ResponseDirect(13010);
}
$this->render($data);
}
/**
* User: zhaoxin
* Date: 2019-09-27
* Time: 16:25
* description 意见反馈
*/
public function advise(){
$user = $this->validateToken();
$requestData = $this->selectParam([
'uuid', 'mobile', 'advise_content'
]);
$requestData['uuid'] = $user['uuid'];
$this->check($requestData, 'Engineer.advise');
$data = EngineerFeedback::build()->insert([
'uuid' => uuid(),
'engineer_uuid' => $user['uuid'],
'content' => $requestData['advise_content'],
'mobile' => $requestData['mobile'],
'create_time' => timeToDate()
]);
if($data == false){
ResponseDirect(13019);
}
$this->render('反馈成功');
}
/**
* User: zhaoxin
* Date: 2019-09-27
* Time: 16:17
* description 关于我们
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function lookInfo(){
$data['list'] = About::build()
->field(['uuid','title'])
->select();
$this->render($data);
}
/**
* User: zhaoxin
* Date: 2019-09-27
* Time: 16:17
* description关于我们详情
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function lookInfoDetail(){
$request = $this->selectParam([
'uuid'
]);
$this->check(['uuid' => $request['uuid']], 'Base.uuid');
$data = About::build()
->where(['uuid' => $request['uuid']])
->field(['uuid','title','content'])
->find();
$this->render($data);
}
/**
* User: zhaoxin
* Date: 2019-09-27
* Time: 16:44
* description
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function questiones(){
$data['list'] = \app\api\model\HelpCenter::build()
->where(['type' => '4'])
->field(['title', 'content'])
->select();
$this->render($data);
}
public function plans(){
$user = $this->validateToken();
$requestData = $this->selectParam([
'start_time','end_time'
]);
$this->check($requestData, 'Engineer.plan');
$data = EngineerLogic::plans($requestData,$user,$this->pageIndex,$this->pageSize);
if($data == false){
ResponseDirect(13020);
}
$this->render($data);
}
public function planInfo(){
$user = $this->validateToken();
$requestData = $this->selectParam([
'plan_uuid'
]);
$this->check(['uuid' => $requestData['plan_uuid']], 'Base.uuid');
$data = EngineerLogic::planInfo($requestData['plan_uuid']);
if($data == false){
ResponseDirect(13020);
}
$this->render($data);
}
/**
* User: zhaoxin
* Date: 2019-09-29
* Time: 18:26
* description
* @throws \think\Exception
*/
public function serviceData(){
$user_info = $this->validateToken();
$where = ['o.engineer_uuid' => $user_info['uuid'],'o.status' => '3'];
$data['count'] = \app\api\model\Order::build()->alias('o')->where($where)->count();
$data['total_money'] = \app\api\model\Order::build()->alias('o')->where($where)->sum('money');
$good_count = \app\api\model\Order::build()
->alias('o')
->join('order_message om','om.order_uuid = o.uuid')
->where($where)
->where(['om.type' => '1'])
->count();
$data['sorce'] = ($data['count'] == 0 || $good_count == 0) ? 0 : ($good_count / $data['count']) * 100;
$data !== false ? $this->render($data) : ResponseDirect(12023);//反馈失败
}
public function saveFormId(){
$userInfo = $this->validateToken();
$request = $this->selectParam(['form_id']);
$result = EngineerLogic::saveFormId($request,$userInfo);
if($result){
$this->render('获取成功');
}else{
ResponseDirect(12070);
}
}
}
<?php
/**
* Created by PhpStorm.
* User: mac
* Date: 2019-09-19
* Time: 14:35
*/
namespace app\api\controller\v1\app;
use app\api\model\EngineeringRegisters;
class Engineering extends Base
{
public $restMethodList = 'get|post|put';
/**
* User: zhaoxin
* Date: 2019-09-19
* Time: 15:06
* description
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function registers(){
$requestData = $this->selectParam(['type' => '1']);
$this->check($requestData,['type' => 'require|number|in:1,2,3']);
$data = EngineeringRegisters::build()->AllRegisters($requestData);
if ($data) {
$this->render($data,200);
} else {
ResponseDirect(14000);//查询工程注册失败
}
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: xiezhixian
* Date: 2019/3/14
* Time: 下午4:01
*/
namespace app\api\controller\v1\app;
use app\api\logic\app\HelpCenterLogic;
class HelpCenter extends Base
{
public $restMethodList = 'get|post|put';
/**
* User: zhaoxin
* Date: 2019-09-19
* Time: 10:00
*/
public function index(){
$request = $this->selectParam(['question']);
$data = HelpCenterLogic::index($request['question'],$this->pageIndex,$this->pageSize);
$this->render(['list'=>$data]);
}
/**
* User: zhaoxin
* Date: 2019-09-19
* Time: 10:00
* @param $id
*/
public function read($id){
$requestData['uuid'] = $id;
$this->check($requestData, 'Base.uuid');
$data = HelpCenterLogic::read($id);
$data !== false ? $this->render($data) : ResponseDirect(10003);
}
/**
* User: zhaoxin
* Date: 2019-09-19
* Time: 10:00
*/
public function feedback(){
$user_info = $this->validateToken();
$requestData = $this->selectParam(['content','img_src']);
$this->check($requestData, 'User.feedback');
$data = HelpCenterLogic::feedback($user_info['uuid'],$requestData);
$data !== false ? $this->render('反馈成功') : ResponseDirect(12016);//反馈失败
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: mac
* Date: 2019-09-24
* Time: 16:55
*/
namespace app\api\controller\v1\app;
use app\api\logic\app\OrderLogic;
class Order extends Base
{
public $restMethodList = 'get|post|put';
public function index(){
$user = $this->validateToken();
$request = $this->selectParam([
'keyword' => '','order_status' => '2','engineering_type' => '1','start_time','end_time'
]);
$this->check($request,'Search.app_order_engineer');
$data = OrderLogic::index($request,$user,$this->pageIndex,$this->pageSize);
if ($data === false) {
ResponseDirect(14016);
}
$this->render($data);
}
public function read($id){
$user = $this->validateToken();
$this->check(['uuid' => $id], 'Base.uuid');
$order = new OrderLogic();
$data = $order->read($id);
if ($data === false) {
ResponseDirect(14018);
}
$this->render($data);
}
/**
* User: zhaoxin
* Date: 2019-09-23
* Time: 17:21
* description 上传表单
*/
public function uploadExcel(){
$user = $this->validateToken();
$request = $this->selectParam([
'uuid','excel_list' => []
]);
$this->check(['uuid' => $request['uuid']], 'Base.uuid');
//验证excel
foreach ($request['excel_list'] as $k => $v) {
$this->check($v,'Engineering.order_excel');
}
$data = OrderLogic::uploadExcel($request);
if ($data === false) {
ResponseDirect(14022);
}
$this->render('上传成功');
}
/**
* User: zhaoxin
* Date: 2019-10-10
* Time: 15:15
* description 维保订单上传合同图片
*/
public function uploadContractImg(){
$this->validateToken();
$request = $this->selectParam([
'uuid','img' => []
]);
$this->check(['uuid' => $request['uuid']], 'Base.uuid');
$data = OrderLogic::uploadContractImg($request);
if ($data === false) {
ResponseDirect(14022);
}
$this->render('上传成功');
}
/**
* User: zhaoxin
* Date: 2019-10-10
* Time: 15:22
* description 维保订单上传合同金额
*/
public function setMoney(){
$this->validateToken();
$request = $this->selectParam([
'uuid','money'
]);
$this->check($request, 'Engineering.money');
$data = OrderLogic::setMoney($request);
if ($data === false) {
ResponseDirect(14051);
}
$this->render('输入金额成功');
}
/**
* User: zhaoxin
* Date: 2019-10-11
* Time: 15:05
* description 下一步
*/
public function next(){
$this->validateToken();
$request = $this->selectParam([
'uuid'
]);
$this->check($request, 'Base.uuid');
$data = OrderLogic::next($request['uuid']);
if ($data === false) {
ResponseDirect(14055);
}
$this->render('操作成功');
}
/**
* User: zhaoxin
* Date: 2019-09-25
* Time: 16:08
* description 节点列表
*/
public function nodes(){
$user = $this->validateToken();
$request = $this->selectParam([
'uuid'
]);
$this->check(['uuid' => $request['uuid']], 'Base.uuid');
$data = OrderLogic::nodes($request['uuid']);
if ($data === false) {
ResponseDirect(14031);
}
$this->render($data);
}
/**
* User: zhaoxin
* Date: 2019-09-25
* Time: 16:08
* description 节点列表
*/
public function nodeDetails(){
$user = $this->validateToken();
$request = $this->selectParam([
'uuid','type' => '1'
]);
$this->check(['uuid' => $request['uuid']], 'Base.uuid');
$data = OrderLogic::nodeDetails($request['uuid'],$request['type']);
if ($data === false) {
ResponseDirect(14031);
}
$this->render($data);
}
/**
* User: zhaoxin
* Date: 2019-09-25
* Time: 16:22
* description 节点添加
*/
public function addNode(){
$user = $this->validateToken();
$request = $this->selectParam([
'uuid','node_name','node_time','node_type'
]);
$this->check($request, 'Engineering.add_node');
$data = OrderLogic::addNode($request);
if ($data === false) {
ResponseDirect(14032);
}
$this->render('添加节点成功');
}
/**
* User: zhaoxin
* Date: 2019-09-25
* Time: 16:22
* description 节点添加
*/
public function addNodeDetail(){
$user = $this->validateToken();
$request = $this->selectParam([
'uuid','node_uuid','node_remark','node_img' => []
]);
$this->check($request, 'Engineering.add_node_detail');
$data = OrderLogic::addNodeDetail($request);
if ($data === false) {
ResponseDirect(14032);
}
$this->render('添加节点进度成功');
}
/**
* User: zhaoxin
* Date: 2019-09-26
* Time: 14:43
* description 申请验收
*/
public function applyCheck(){
$user = $this->validateToken();
$request = $this->selectParam([
'uuid'
]);
$this->check(['uuid' => $request['uuid']], 'Base.uuid');
$data = OrderLogic::applyCheck($request['uuid'], $user);
if ($data === false) {
ResponseDirect(14039);
}
$this->render('申请验收成功');
}
public function datas(){
$user = $this->validateToken();
$request = $this->selectParam([
'year'
]);
$this->check($request, ['year' => 'require']);
$data = OrderLogic::datas($request['year'],$user['uuid']);
if ($data === false) {
ResponseDirect(14046);
}
$this->render($data);
}
}
\ No newline at end of file
<?php
namespace app\api\controller\v1\app;
use app\api\model\UserSms;
use app\api\controller\Api;
use think\Controller;
use app\api\logic\app\SendLogic;
use app\api\logic\app\UserLogic;
class User extends Base
{
/**
* 允许访问的方式列表,资源数组如果没有对应的方式列表,请不要把该方法写上,如user这个资源,客户端没有delete操作
*/
public $restMethodList = 'get|post|put|';
public function login()
{
$requestData = $this->selectParam(['openid','avatar','unionid'=>'','wechat_name']);
$this->check($requestData, [
'openid'=>'require',
'avatar'=>"require",
'wechat_name'=>"require",
]);
$result = \app\api\model\User::build()->login($requestData);
if ($result) {
$this->render($result);
} else {
ResponseDirect(12003);
}
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: mac
* Date: 2019-04-11
* Time: 17:35
*/
namespace app\api\controller\v1\network;
use app\api\logic\network\NetworkLogic;
use think\Session;
class Admin extends Base
{
public $restMethodList = 'get|post|put|delete';
public function _initialize()
{
parent::_initialize();
}
/**
* User: zhaoxin
* Date: 2019-09-21
* Time: 10:21
* description 登陆
*/
public function login()
{
$requestData = $this->selectParam(['account', 'password']);
$this->check($requestData, 'admin.login');
$data = NetworkLogic::login($requestData['account'], $requestData['password']);
if ($data) {
$this->render($data,200);
} else {
ResponseDirect(15007);//账号密码错误
}
}
/**
* User: zhaoxin
* Date: 2019-09-21
* Time: 10:22
* description
*/
public function save(){
// $this->validateToken();
$requestData = $this->selectParam([
'account' => '',
'name' => '',
'mobile' => '',
'password' => '',
'group_uuid' => ''
]);
$this->check($requestData, 'Admin.cms_save');
$bool = SellerLogic::save($requestData);
$bool !== false ? $this->render(200) : $this->returnmsg(403);
}
/**
* User: zhaoxin
* Date: 2019-09-21
* Time: 10:22
* description 查看权限
*/
public function menuInfo(){
$requestData = $this->selectParam([
'uuid' => '',
]);
$this->check($requestData, 'Base.uuid');
$list = SellerLogic::menuInfo($requestData['uuid']);
if($list){
$this->render($list);
}else{
ResponseDirect('查看管理员权限失败',403);
}
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: mac
* Date: 2019-04-11
* Time: 17:37
*/
namespace app\api\controller\v1\network;
use app\api\logic\network\GroupLogic;
use app\api\controller\Api;
use app\api\model\ServiceNetworkToken;
use think\Request;
use think\Hook;
use think\Session;
class Base extends Api
{
public function __construct(Request $request = null)
{
// Hook::add('response_end', 'app\common\behavior\sellerLog', true);
parent::__construct($request);
}
protected function validateToken() {
$token = getToken();
$user_info = ServiceNetworkToken::validateToken($token);
if (!$user_info) {
self::returnmsg(401, [], [], "", "AUTH ERROR", "鉴权失败");
}
Session::set('network_info', $user_info);
// //记录用户访问记录
// $count = SellerActive::build()->where(['seller_uuid' => $user_info['uuid']])->whereTime('create_time','today')->count();
// //今天第一次活跃
// if($count < 1){
// SellerActive::build()->insert([
// 'uuid' => uuid(),
// 'create_time' => timeToDate(),
// 'seller_uuid' => $user_info['uuid']
// ]);
// }
return $user_info;
}
protected function hasPermission() {
$controller = $this->request->controller();
$controller_path = explode('.', $controller);
$controller = strtolower(end($controller_path));
$action = strtolower($this->request->action());
$seller_info = Session::get('seller_info');
$bool = GroupLogic::hasPermission($seller_info['seller_admin_uuid'], $controller, $action);
if (!$bool) {
self::returnmsg(401, [], [], "", "AUTH ERROR", "您没有权限,请联系超级管理员");
}
}
/**
* @author: ChiaHsiang
* @time: 2018/8/10
* @description: 从前端获取文件,存入public/excel目录下,返回文件全路径
* @return string
*/
public function getFile() {
if (empty($_FILES['file'])) {
$this->render(403);
}
$file = request()->file('file');
$info = $file->rule('uniqid')->move(ROOT_PATH.'public' . DS . 'excel');
if (!$info) {
$this->render(403);
}
$file = $info->getFilename();
$save_path = ROOT_PATH . 'public' . DS . 'excel' . DS;
$file_name = $save_path . $file;
return $file_name;
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: mac
* Date: 2019-09-20
* Time: 14:40
*/
namespace app\api\controller\v1\network;
use app\api\logic\network\EngineerLogic;
use think\Session;
class Engineer extends Base
{
public $restMethodList = 'get|put|post|delete';
public function _initialize()
{
parent::_initialize();
$this->validateToken();
}
/**
* User: zhaoxin
* Date: 2019-09-20
* Time: 15:07
* description 工程师列表
*/
public function index(){
$request = $this->selectParam([
'keyword' => '','service_type' => '','is_authentication' => '','province' => '',
'city' => '','county' => '','user_type' => '','is_export'
]);
$this->check($request,'Search.engineer_search');
$EngineerLogic = new EngineerLogic();
$data = $EngineerLogic->index($request,$this->pageIndex,$this->pageSize);
if($request['is_export'] == '1'){
$header = ['序号','姓名','联系方式','地区','工程师类型','添加时间','是否认证'];
excelExport('工程师列表',$header,$data);
}
$data !== false ? $this->render($data) : ResponseDirect(13011);
}
/**
* User: zhaoxin
* Date: 2019-09-20
* Time: 15:13
* description 工程师详情
* @param $id
*/
public function read($id){
$this->check(['uuid' => $id],'Base.uuid');
$EngineerLogic = new EngineerLogic();
$data = $EngineerLogic->read($id);
$data !== false ? $this->render($data) : ResponseDirect(13012);
}
/**
* User: zhaoxin
* Date: 2019-09-20
* Time: 15:16
* description 删除
* @param $id
*/
public function delete($id){
$this->check(['uuid' => $id],'Base.uuid');
$data = EngineerLogic::delete($id);
$data !== false ? $this->render('删除成功') : ResponseDirect(13013);
}
/**
* User: zhaoxin
* Date: 2019-09-20
* Time: 15:20
* description 新增
*/
public function save(){
$user = $this->validateToken();
$requestData = $this->selectParam([
'mobile', 'password',
'service_type','name','province','city','county','service_day' => [],'service_time' => [],'service_skill' => [],
'id_img_one','id_img_two','other_img' => [],'number' => ''
]);
$this->check($requestData, 'Engineer.cms_register');
$data = \app\api\model\Engineer::build()->register($requestData,'2',$user);
if ($data){
$this->render('新增成功',200);
}else{
ResponseDirect(13001);
}
}
/**
* User: zhaoxin
* Date: 2019-09-26
* Time: 17:47
* description 认证
*/
public function authentication(){
$requestData = $this->selectParam(['engineer_uuid','is_authentication']);
$this->check($requestData, 'Engineer.authentication');
$data = \app\api\model\Engineer::build()->authentication($requestData);
if ($data){
$this->render('操作成功',200);
}else{
ResponseDirect(13017);
}
}
/**
* User: zhaoxin
* Date: 2019-09-29
* Time: 11:13
* description 导入
*/
public function import(){
$file_name = $this->getFile();
$info = Session::get('network_info');
$service_uuid = $info['uuid'];
$bool = \app\api\model\Engineer::import('Xlsx',$file_name,$service_uuid,'2');
if($bool['status'] == '1'){
$this->render(['message' => $bool['message']]);
}
elseif($bool['status'] == '2'){
$this->render(['message' => $bool['message'],'info'=>$bool['info']],403);
}
else{
ResponseDirect(13021);
}
}
/**
* User: zhaoxin
* Date: 2019-09-29
* Time: 11:16
* description
*/
public function downTemplate()
{
$name = '用户导入模版下载';
$header = [
'姓名','联系方式','省','市','区','工程师类型',
];
$data[] = [
'某某某','13302516724','广东省','深圳市','龙岗区','工程师'
];
excelExport($name,$header,$data);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: mac
* Date: 2019-04-11
* Time: 10:05
*/
namespace app\api\controller\v1\network;
use app\api\logic\cms\FinanceLogic;
use app\api\model\ServiceNetwork;
use think\Session;
class Finance extends Base
{
/**
* 允许访问的方式列表,资源数组如果没有对应的方式列表,请不要把该方法写上,如user这个资源,客户端没有delete操作
*/
public $restMethodList = 'get|post|put';
public function _initialize()
{
parent::_initialize();
//$this->hasPermission();
$this->validateToken();
}
public function index(){
$requestData = $this->selectParam([
'engineering_type','start_time','end_time','is_export'
]);
$this->check($requestData,'Search.finances');
$info = Session::get('network_info');
$requestData['service_uuid'] = $info['uuid'];
$data = \app\api\model\Order::finances($requestData,$this->pageIndex,$this->pageSize,'2');
if ($requestData['is_export']==1) {
$name='财务订单信息';
$header=['订单编号','联系人','联系方式','省','市','服务类型','提交时间','工程类型'];
excelExport($name,$header,$data);
}
$data !== false ? $this->render($data): ResponseDirect(16371);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: mac
* Date: 2019-04-13
* Time: 11:02
*/
namespace app\api\controller\v1\network;
use app\api\logic\network\GroupLogic;
use app\api\model\Operation;
use app\common\tools\wechatUtil;
class Groups extends Base
{
public $restMethodList = 'get|post|put|delete';
public function _initialize()
{
parent::_initialize();
}
/**
* @author: Airon
* @time: 2019年4月
* description
* @throws \think\exception\DbException
*/
public function adminList() {
// $this->validateToken();
$this->hasPermission();
$requestData = $this->selectParam(['keyword']);
$this->check($requestData, 'Base.keyword');
$GroupLogic = new GroupLogic();
$data = $GroupLogic->index($requestData,$this->pageIndex, $this->pageSize);
$data !== false ? $this->render($data) : $this->returnmsg(403);
}
/**
* @author: Airon
* @time: 2019年4月
* description 获取组相关权限
* @param $id
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function read($id) {
// $this->validateToken();
$this->check(['uuid' => $id], 'Base.uuid');
$data = GroupLogic::read($id);
$data !== false ? $this->render($data) : $this->returnmsg(403);
}
/*
* 新增
*/
public function save(){
// $this->validateToken();
$requestData = $this->selectParam([
'uuid' => '',
'menu_uuid' => []
]);
$this->check($requestData, 'Groups.menu_save');
$bool = GroupLogic::save($requestData);
$bool !== false ? $this->render('分配权限成功') : $this->returnmsg(403);
}
/*
* 添加商家后台管理员
*/
public function addSellerAdmin(){
// $this->validateToken();
$requestData = $this->selectParam([
'account' => '',
'password' => '',
'name' => '',
'mobile' => ''
]);
$this->check($requestData, 'Groups.seller_save');
$GroupLogic = new GroupLogic();
$bool = $GroupLogic->addSellerAdmin($requestData);
if($bool){
$this->render('添加成功');
}else{
ResponseDirect('添加管理员失败',403);
}
}
/*
* 编辑
*/
public function update(){
// $this->validateToken();
$requestData = $this->selectParam([
'uuid' => '',
'account' => '',
'password' => '',
'name' => '',
'mobile' => ''
]);
$this->check($requestData, 'Groups.seller_update');
$bool = GroupLogic::update($requestData);
$bool !== false ? $this->render('编辑成功') : $this->returnmsg(403);
}
/*
* 查看当前管理员的权限
*/
public function menuInfo(){
// $this->validateToken();
$requestData = $this->selectParam([
'uuid' => '',
]);
$this->check($requestData, 'Base.uuid');
$list = GroupLogic::menuInfo($requestData['uuid']);
if($list){
$this->render($list);
}else{
ResponseDirect('查看管理员权限失败',403);
}
}
/*
* 删除
*/
public function delete($id){
// $this->validateToken();
$this->check([
'uuid' => $id,
], 'Base.uuid');
$bool = GroupLogic::delete($id);
$bool !== false ? $this->render('删除成功') : $this->returnmsg(403);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: mac
* Date: 2019-09-21
* Time: 10:37
*/
namespace app\api\controller\v1\network;
use app\api\logic\network\NetworkLogic;
use app\api\model\ServiceNetwork;
class Info extends Base
{
public $restMethodList = 'get|post|put|delete';
public function _initialize()
{
parent::_initialize();
$this->validateToken();
}
/**
* User: zhaoxin
* Date: 2019-09-21
* Time: 11:07
* description 基本信息
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function index(){
$logic = new NetworkLogic();
$data = $logic->info();
if($data == false){
ResponseDirect(15008);
}
$this->render($data);
}
/**
* User: zhaoxin
* Date: 2019-09-21
* Time: 15:07
* description 查看审核信息
* @param $id
*/
public function read($id){
$this->check(['uuid' => $id],'Base.uuid');
$data = NetworkLogic::read($id);
$data !== false ? $this->render($data) : ResponseDirect(15008);
}
/**
* User: zhaoxin
* Date: 2019-09-21
* Time: 11:08
* description 编辑
* @param $id
*/
public function update($id){
$request = $this->selectParam([
'name' => '','contact_mobile'=> '','contact_name' => '','province','city','county',
'address','introduce'
]);
$this->check($request,'network.update');
$data =ServiceNetwork::build()->updateInfo2($request,$id);
$data !== false ? $this->render('编辑成功') : ResponseDirect(15003);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: mac
* Date: 2019-04-12
* Time: 18:14
*/
namespace app\api\controller\v1\network;
use app\api\logic\network\MenuBarLogic;
class Menus extends Base
{
public $restMethodList = 'get|post|put|delete';
public function _initialize()
{
parent::_initialize();
//$this->hasPermission();
// $this->validateToken();
}
/**
* @author: Airon
* @time: 2019年4月
* description
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function index()
{
$data = MenuBarLogic::index();
$data !== false ? $this->render($data) : $this->returnmsg(403);
}
public function save()
{
$requestData = $this->selectParam([
'sort' => 0,
'name',
'url' => '',
'classes' => '',
'parent_uuid' => '0',
'authority_url' => '',
]);
$requestData['parent_uuid'] = empty($requestData['parent_uuid'])?0:$requestData['parent_uuid'];
$this->check($requestData, 'MenuBars.seller_save');
$bool = MenuBarLogic::save($requestData);
$bool !== false ? $this->render(200) : $this->returnmsg(403);
}
public function update($id)
{
$requestData = $this->selectParam([
'uuid' => $id,
'sort' => 0,
'name',
'url' => '',
'classes' => '',
'parent_uuid' => '0',
'authority_url' => ''
]);
$requestData['parent_uuid'] = empty($requestData['parent_uuid'])?0:$requestData['parent_uuid'];
$this->check($requestData, 'MenuBars.selller_update');
$bool = MenuBarLogic::update($requestData);
$bool !== false ? $this->render(200) : $this->returnmsg(403);
}
public function delete($id)
{
$this->check(['uuid' => $id], 'Base.uuid');
$bool = MenuBarLogic::delete($id);
$bool !== false ? $this->render(200) : $this->returnmsg(403);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: mac
* Date: 2019-09-24
* Time: 15:03
*/
namespace app\api\controller\v1\network;
use app\api\logic\network\OrderLogic;
class Order extends Base
{
public $restMethodList = 'get|post|put|delete';
public function _initialize()
{
parent::_initialize();
$this->validateToken();
}
public function index(){
$request = $this->selectParam([
'keyword' => '','province','city','county','order_status' => '1',
'is_export','engineering_type' => '1'
]);
$this->check($request,'Search.order_cms');
$order = new OrderLogic();
$data = $order->index($request,$this->pageIndex,$this->pageSize);
if ($data === false) {
ResponseDirect(14016);
}
if($request['is_export'] == '1'){
$header = ['序号','订单编号','联系人','联系方式','地区','服务类型','提交时间','是否需要勘测'];
excelExport('订单列表',$header,$data);
}
$this->render($data);
}
/**
* User: zhaoxin
* Date: 2019-09-23
* Time: 18:20
* description
* @param $id
*/
public function read($id){
$this->check(['uuid' => $id], 'Base.uuid');
$order = new OrderLogic();
$data = $order->read($id);
if ($data === false) {
ResponseDirect(14018);
}
$this->render($data);
}
/**
* User: zhaoxin
* Date: 2019-09-24
* Time: 15:31
* description 指派
*/
public function appoint(){
$request = $this->selectParam([
'order_uuid','appoint_uuid'
]);
$this->check($request,'Engineering.network_order_appoint');
$order = new OrderLogic();
$data = $order->appoint($request);
if ($data === false) {
ResponseDirect(14018);
}
$this->render('指派成功');
}
/**
* User: zhaoxin
* Date: 2019-09-24
* Time: 14:58
* description 取消订单
*/
public function cancel(){
$request = $this->selectParam([
'uuid'
]);
$this->check($request, 'Base.uuid');
$data = \app\api\logic\web\OrderLogic::cancel($request['uuid']);
if ($data === false) {
ResponseDirect(14021);
}
$this->render('取消成功');
}
/**
* User: zhaoxin
* Date: 2019-09-25
* Time: 14:37
* description 确认指派
*/
public function confirmAppoint(){
$request = $this->selectParam([
'order_uuid'
]);
$this->check($request,'Engineering.order_uuid');
$data = OrderLogic::confirmAppoint($request['order_uuid']);
if ($data === false) {
ResponseDirect(14025);
}
$this->render('确认指派成功');
}
/**
* User: zhaoxin
* Date: 2019-09-25
* Time: 14:31
* description 上传支付凭证
*/
public function updateCertificate(){
$user = $this->validateToken();
$request = $this->selectParam([
'order_uuid','money'
]);
$this->check($request,'Engineering.order_cms_pay');
$data = \app\api\model\Order::updateCertificate($request);
if ($data === false) {
ResponseDirect(14029);
}
$this->render('上传成功');
}
/**
* User: zhaoxin
* Date: 2019-09-25
* Time: 15:04
* description 支付确认
*/
public function confirmPay(){
$request = $this->selectParam([
'order_uuid'
]);
$this->check($request,'Engineering.order_uuid');
$data = \app\api\model\Order::confirmPay($request['order_uuid'],'2');
if ($data === false) {
ResponseDirect(14025);
}
$this->render('确认支付成功');
}
/**
* User: zhaoxin
* Date: 2019-10-11
* Time: 16:42
* description
*/
public function nodeDetails(){
$request = $this->selectParam([
'uuid','type' => '1'
]);
$this->check(['uuid' => $request['uuid']], 'Base.uuid');
$data = \app\api\logic\app\OrderLogic::nodeDetails($request['uuid'],$request['type']);
if ($data === false) {
ResponseDirect(14031);
}
$this->render($data);
}
/**
* User: zhaoxin
* Date: 2019/10/23
* Time: 11:07 上午
* description
* @throws \think\Exception
*/
public function save(){
$request = $this->selectParam([
'user_uuid','type','engineering_uuid','describe','contact_name','contact_mobile',
'province','city','county','address','excel_list' => []
]);
$this->check($request, 'Engineering.order_cms_save');
//验证excel
foreach ($request['excel_list'] as $k => $v) {
$this->check($v,'Engineering.order_excel');
}
$user = ['uuid' => $request['user_uuid']];
unset($request['user_uuid']);
$data = \app\api\logic\web\OrderLogic::save($request,$user);
if ($data === false) {
ResponseDirect(14013);
}
$this->render('提交成功');
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: mac
* Date: 2019-09-27
* Time: 18:21
*/
namespace app\api\controller\v1\network;
use app\api\model\Target as TargetModel;
use think\Session;
class Target extends Base
{
public $restMethodList = 'get|post|put|delete';
public function _initialize()
{
parent::_initialize();
$this->validateToken();
}
public function index(){
$request = $this->selectParam([
'keyword','target_uuid','start_time','end_time'
]);
$network = Session::get('network_info');
$request['service_uuid'] = $network['uuid'];
$this->check($request,'Search.target');
$data = TargetModel::build()->index($request,$this->pageIndex,$this->pageSize);
if ($data === false) {
ResponseDirect(17000);
}
$this->render($data);
}
public function save(){
$request = $this->selectParam([
'target_uuid','title','start_time','end_time','content'
]);
$network = Session::get('network_info');
$request['service_uuid'] = $network['uuid'];
$this->check($request,'engineering.target_save');
$data = TargetModel::build()->saveInfo($request);
if ($data === false) {
ResponseDirect(17001);
}
$this->render('新增成功');
}
public function update($id){
$request = $this->selectParam([
'target_uuid','title','start_time','end_time','content'
]);
$network = Session::get('network_info');
$request['service_uuid'] = $network['uuid'];
$this->check($request,'engineering.target_save');
$data = TargetModel::build()->updateInfo($request,$id);
if ($data === false) {
ResponseDirect(17002);
}
$this->render('编辑成功');
}
public function delete($id){
$data = TargetModel::build()->where(['uuid' => $id])->delete();
if ($data === false) {
ResponseDirect(17003);
}
$this->render('删除成功');
}
public function read($id){
$data = TargetModel::build()->where(['uuid' => $id])->find();
if ($data === false) {
ResponseDirect(17003);
}
$this->render($data);
}
public function achievements(){
$request = $this->selectParam([
'target_uuid','keyword'
]);
$network = Session::get('network_info');
$request['service_uuid'] = $network['uuid'];
$this->check($request,'engineering.achievements');
$data = TargetModel::build()->achievements($request,$this->pageIndex,$this->pageSize);
if ($data === false) {
ResponseDirect(17000);
}
$this->render($data);
}
public function lists(){
$data = \app\api\model\EngineeringTarget::build()
->where(['is_delete' => '0'])
->field(['uuid','title'])
->order(['create_time' => timeToDate()])
->select();
if ($data){
$this->render(['list' => $data],200);
}else{
ResponseDirect(14009);
}
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: xiezhixian
* Date: 2019/3/14
* Time: 下午4:01
*/
namespace app\api\controller\v1\network;
use app\api\logic\network\WithdrawalLogic;
class Withdrawal extends Base
{
public $restMethodList = 'get|post|put';
public function _initialize()
{
parent::_initialize();
//$this->validateToken();
}
/**
* @author: jkl
* @time: 2019年5月
* description 用户提现列表
*/
public function index(){
$user = $this->validateToken();
$request = $this->selectParam(['start_time','end_time','status'=>'','is_export'=>0]);
$result = WithdrawalLogic::index($user,$request,$this->pageIndex,$this->pageSize);
if ($request['is_export']==1) {
$name='网点提现信息';
$header=['服务网点','联系人','联系方式','省','市','提现时间','提现状态','提现金额'];
excelExport($name,$header,$result);
}
$result != false ? $this->render($result) :ResponseDirect(18003);
}
/**
* @author: jkl
* @time: 2019年5月
* description 用户提现详情
*/
public function read($id){
$user = $this->validateToken();
$this->check(['uuid'=>$id],"ServiceWithdrawal.uuid");
$result = WithdrawalLogic::read($id);
$result != false ? $this->render($result) : ResponseDirect(18004);
}
//发起提现
public function submit(){
$user = $this->validateToken();
$request = $this->selectParam(['money','account','card','payee','mobile','password']);
$this->check($request,"ServiceWithdrawal.submit");
$request['uuid'] = uuid();
$request['service_uuid'] = $user['uuid'];
$request['create_time'] = timeToDate();
$result = WithdrawalLogic::submit($user,$request);
$result != false ? $this->render("操作成功") : ResponseDirect(18000);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: xiezhixian
* Date: 2018/7/17
* Time: 上午11:04
*/
namespace app\api\controller\v1\web;
use app\api\controller\Api;
use app\api\model\UserToken;
use app\api\logic\web\UserLogic;
class Base extends Api
{
protected function validateToken(){
$token = getToken();
$bool = UserToken::build()->validateToken($token);
if (!$bool) {
self::returnmsg(401, [], [], "", "AUTH ERROR", "鉴权失败");
}
return $bool;
}
/**
* @author: zhaoxin
* @time: 2019年3月
* description 判断当前短信的类型
*/
protected function validateSmsType($requestData,$type = 'user'){
$method = 'check'.ucfirst($type);
//注册
if($requestData['sms_type'] == 'pass') {
$bool = UserLogic::$method($requestData['mobile']);
if(!empty($bool)){
self::returnmsg(403, [], [],"", "", "该手机号已注册");
}
}
//忘记密码
elseif(in_array($requestData['sms_type'],['getback','reset'])) {
$bool = UserLogic::$method($requestData['mobile']);
if(empty($bool)){
self::returnmsg(403, [], [],"", "", "该手机号未注册");
}
}
//修改密码
elseif($requestData['sms_type'] == 'bind'){
return true;
}
//授权
elseif($requestData['sms_type'] == 'oauth'){
return true;
}else{
self::returnmsg(403, [], [],"", "", "短信类型错误");
}
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: ChiaHsiang
* Date: 2018/7/25
* Time: 19:22
*/
namespace app\api\controller\v1\web;
use app\api\logic\web\ConfigLogic;
use think\Collection;
class Config extends Base
{
public $restMethodList = 'get|put|post';
public function _initialize()
{
parent::_initialize();
//$this->hasPermission();
$this->validateToken();
}
public function read($id) {
$requestData = $this->selectParam([
'key' => $id,
]);
$this->check($requestData, [
'key' => 'require|in:register_agreement'
], [
'key' => '资源类型 ',
]);
$data = ConfigLogic::read($requestData['key']);
$data !== false ? $this->render($data) : $this->returnmsg(16052);
}
public function update($id) {
$requestData = $this->selectParam([
'key' => $id,
'value' => '',
]);
$this->check($requestData, [
'key' => 'require|in:register_agreement',
'value' => 'require',
], [
'key' => '资源类型 ',
'value' => '资源值 ',
]);
$bool = ConfigLogic::update($requestData);
$bool !== false ? $this->render('编辑成功') : $this->returnmsg(16051);
}
public function poster(){
$data = \app\api\model\Config::build()->where('key','poster')->value('value');
$this->render($data);
}
public function update_poster(){
$request = $this->selectParam(['poster']);
$data = \app\api\model\Config::build()->where('key','poster')->update(['value'=>$request['poster']]);
$data !== false ? $this->render(200) : $this->returnmsg(403);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: ChiaHsiang
* Date: 2018/7/25
* Time: 19:22
*/
namespace app\api\controller\v1\web;
use app\api\logic\cms\ExampleLogic;
use app\api\logic\cms\CooperatorLogic;
use app\api\logic\cms\BannerLogic;
use app\api\logic\cms\EngineeringLogic;
use app\api\logic\cms\AdvantageLogic;
use app\api\logic\cms\HelpCenterLogic;
use app\api\logic\cms\HelpCenterTypeLogic;
use app\api\logic\cms\AboutLogic;
use app\api\logic\cms\NewsLogic;
use think\Collection;
class Index extends Base
{
public $restMethodList = 'get|put|post';
public function _initialize()
{
parent::_initialize();
//$this->hasPermission();
//$this->validateToken();
}
public function cooperator() {
$data = CooperatorLogic::index($this->pageIndex,$this->pageSize);
$data !== false ? $this->render($data) : $this->returnmsg(16110);
}
public function banner() {
$data = BannerLogic::index($this->pageIndex,$this->pageSize);
$data !== false ? $this->render($data) : $this->returnmsg(200041);
}
public function example() {
$data = ExampleLogic::index($this->pageIndex,$this->pageSize);
$data !== false ? $this->render($data) : $this->returnmsg(16081);
}
public function example_detail() {
$request = $this->selectParam(['uuid']);
$data = ExampleLogic::read($request['uuid']);
$data !== false ? $this->render($data) : $this->returnmsg(16082);
}
public function project() {
$request = $this->selectParam(['engineering_type']);
$data = EngineeringLogic::index($request,$this->pageIndex,$this->pageSize);
$data !== false ? $this->render($data) : $this->returnmsg(14003);
}
public function advantage() {
$data = AdvantageLogic::index($this->pageIndex,$this->pageSize);
$data !== false ? $this->render($data) : $this->returnmsg(16160);
}
public function help() {
$requestData = $this->selectParam(['type']);
$data = HelpCenterLogic::index($requestData,$this->pageIndex,$this->pageSize);
$this->render($data);
}
public function type_lists() {
$data = HelpCenterTypeLogic::index($condition=1);
$this->render($data);
}
public function help_detail() {
$requestData = $this->selectParam(['uuid']);
$this->check($requestData, 'HelpCenter.uuid');
$data = HelpCenterLogic::read($requestData['uuid']);
$this->render($data);
}
/**
* 关于我们
*/
public function about() {
$data = AboutLogic::index($this->pageIndex,$this->pageSize);
$data !== false ? $this->render($data) : $this->returnmsg(16180);
}
/**
* 关于我们详情
*/
public function about_detail() {
$requestData = $this->selectParam(['uuid']);
$data = AboutLogic::read($requestData['uuid']);
$data !== false ? $this->render($data) : $this->returnmsg(16181);
}
/**
* 企业新闻
*/
public function news() {
$data = NewsLogic::index($this->pageIndex,$this->pageSize);
$data !== false ? $this->render($data) : $this->returnmsg(16260);
}
/**
* 关于我们详情
*/
public function news_detail() {
$requestData = $this->selectParam(['uuid']);
$data = NewsLogic::read($requestData['uuid']);
$data !== false ? $this->render($data) : $this->returnmsg(16261);
}
/**
* 地图
*/
public function map() {
$data = \app\api\logic\cms\NetworkLogic::map();
$data !== false ? $this->render($data) : $this->returnmsg(15012);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: ChiaHsiang
* Date: 2018/7/23
* Time: 14:15
*/
namespace app\api\controller\v1\web;
use app\api\logic\web\MessageLogic;
class Message extends Base
{
public $restMethodList = 'get|post|delete|put';
public function _initialize()
{
parent::_initialize();
// $this->hasPermission();
//$this->validateToken();
}
/*
* 列表
*/
public function index()
{
$user = $this->validateToken();
$request = $this->selectParam(['uuid'=>[]]);
$data = MessageLogic::index($user,$request,$this->pageIndex,$this->pageSize);
if(!empty($request['uuid'])){
$data !== false ? $this->render('标记成功') : ResponseDirect(16315);
}
$data !== false ? $this->render($data) : ResponseDirect(16310);
}
/*
* 详情
*/
public function read($id)
{
$user = $this->validateToken();
$this->check(['uuid' => $id], 'Message.uuid');
$data = MessageLogic::read($user,$id);
$data !== false ? $this->render($data) : ResponseDirect(16311);
}
/*
* 创建
*/
public function save()
{
$requestData = $this->selectParam(['title','content']);
$requestData['uuid'] = uuid();
$requestData['create_time'] = timeToDate();
$this->check($requestData, 'Message.save');
$bool = MessageLogic::save($requestData);
$bool !== false ? $this->render('新增成功'): ResponseDirect(16312);
}
/*
* 创建
*/
public function update()
{
$requestData = $this->selectParam(['title','content']);
$requestData['uuid'] = uuid();
$requestData['create_time'] = timeToDate();
$this->check($requestData, 'Message.update');
$bool = MessageLogic::save($requestData);
$bool !== false ? $this->render('编辑成功'): ResponseDirect(16313);
}
/*
* 删除
*/
public function delete($id)
{
$this->check(['uuid' => $id], 'Message.uuid');
$bool = MessageLogic::delete($id);
$bool !== false ? $this->render('删除成功'): ResponseDirect(16314);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: mac
* Date: 2019-09-23
* Time: 11:02
*/
namespace app\api\controller\v1\web;
use think\Collection;
use app\api\logic\web\OrderLogic;
class Order extends Base
{
public $restMethodList = 'get|put|post|delete';
public function _initialize()
{
parent::_initialize();
}
/**
* User: zhaoxin
* Date: 2019-09-24
* Time: 17:09
* description
*/
public function engineerings(){
$request = $this->selectParam(['type']);
$this->check($request, 'Engineering.type');
$data = OrderLogic::engineerings($request);
if ($data === false) {
ResponseDirect(14003);
}
$this->render($data);
}
/**
* User: zhaoxin
* Date: 2019-09-24
* Time: 17:09
* description
*/
public function save(){
$user = $this->validateToken();
$request = $this->selectParam([
'type','engineering_uuid','describe','contact_name','contact_mobile',
'province','city','county','address','excel_list' => []
]);
$this->check($request, 'Engineering.order_save');
//验证excel
foreach ($request['excel_list'] as $k => $v) {
$this->check($v,'Engineering.order_excel');
}
$data = OrderLogic::save($request,$user);
if ($data === false) {
ResponseDirect(14013);
}
$this->render('提交成功');
}
/**
* User: zhaoxin
* Date: 2019-09-23
* Time: 16:41
* description
*/
public function index(){
$user = $this->validateToken();
$request = $this->selectParam([
'keyword','start_time','end_time','order_status' => '1','engineering_type' => '1'
]);
$this->check($request, 'search.order');
$data = OrderLogic::index($request,$user,$this->pageIndex,$this->pageSize);
if ($data === false) {
ResponseDirect(14016);
}
$this->render($data);
}
/**
* User: zhaoxin
* Date: 2019-09-24
* Time: 17:30
* description
* @param $id
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function read($id){
$user = $this->validateToken();
$this->check(['uuid' => $id], 'Base.uuid');
$data = OrderLogic::read($id);
if ($data === false) {
ResponseDirect(14018);
}
$this->render($data);
}
public function update($id){
$user = $this->validateToken();
$this->check(['uuid' => $id], 'Base.uuid');
$request = $this->selectParam([
'contact_name','contact_mobile','province','city','county','address',
]);
$this->check($request, 'Engineering.order_update');
$data = OrderLogic::update($request,$id);
if ($data === false) {
ResponseDirect(14019);
}
$this->render('编辑成功');
}
/**
* User: zhaoxin
* Date: 2019-09-23
* Time: 17:12
* description 取消订单
*/
public function cancel(){
$user = $this->validateToken();
$request = $this->selectParam([
'uuid'
]);
$this->check($request, 'Base.uuid');
$data = OrderLogic::cancel($request['uuid']);
if ($data === false) {
ResponseDirect(14021);
}
$this->render('取消成功');
}
/**
* User: zhaoxin
* Date: 2019-09-23
* Time: 17:21
* description 上传表单
*/
public function uploadExcel(){
$user = $this->validateToken();
$request = $this->selectParam([
'uuid','excel_list' => []
]);
$this->check(['uuid' => $request['uuid']], 'Base.uuid');
//验证excel
foreach ($request['excel_list'] as $k => $v) {
$this->check($v,'Engineering.order_excel');
}
$data = OrderLogic::uploadExcel($request);
if ($data === false) {
ResponseDirect(14022);
}
$this->render('上传成功');
}
/**
* User: zhaoxin
* Date: 2019-09-23
* Time: 17:25
* description excel删除
*/
public function deleteExcel(){
$user = $this->validateToken();
$request = $this->selectParam([
'excel_uuid'
]);
$this->check($request,'Engineering.order_excel_delete');
$data = OrderLogic::deleteExcel($request);
if ($data === false) {
ResponseDirect(14022);
}
$this->render('删除成功');
}
/**
* User: zhaoxin
* Date: 2019-09-25
* Time: 14:31
* description 上传支付凭证
*/
public function updateCertificate(){
$user = $this->validateToken();
$request = $this->selectParam([
'order_uuid','money','pay_img','pay_type'
]);
$this->check($request,'Engineering.order_pay');
$data = \app\api\model\Order::updateCertificate($request);
if ($data === false) {
ResponseDirect(14029);
}
$this->render('上传成功');
}
/**
* User: zhaoxin
* Date: 2019-09-25
* Time: 15:43
* description 进度查看
*/
public function progresses(){
$user = $this->validateToken();
$request = $this->selectParam([
'order_uuid'
]);
$this->check($request,'Engineering.order_uuid');
$data = OrderLogic::progresses($request);
if ($data === false) {
ResponseDirect(14031);
}
$this->render($data);
}
/**
* User: zhaoxin
* Date: 2019-09-26
* Time: 15:31
* description 确认验收
*/
public function confirmCheck(){
$user = $this->validateToken();
$request = $this->selectParam([
'order_uuid','money','pay_img','pay_type'
]);
$pay_type = \app\api\model\Order::build()
->where(['uuid' => $request['order_uuid']])
->field(['pay_type','type'])
->find();
if ($pay_type == '1' && $pay_type['type'] == '1') {
$this->check($request,'Engineering.order_pay');
}
$data = OrderLogic::comfirmCheck($request);
if ($data === false) {
ResponseDirect(14040);
}
$this->render('确认验收成功');
}
/**
* User: zhaoxin
* Date: 2019-09-26
* Time: 15:48
* description 评价信息
*/
public function messagees(){
$user = $this->validateToken();
$request = $this->selectParam([
'order_uuid'
]);
$this->check($request,'Engineering.order_uuid');
$data = OrderLogic::messagees($request['order_uuid']);
if ($data === false) {
ResponseDirect(14040);
}
$this->render($data);
}
/**
* User: zhaoxin
* Date: 2019-09-26
* Time: 16:35
* description 订单评论
*/
public function message(){
$user = $this->validateToken();
$request = $this->selectParam([
'order_uuid','message_type','message_content'
]);
$this->check($request,'Engineering.order_message');
$data = OrderLogic::message($request,$user);
if ($data === false) {
ResponseDirect(14040);
}
$this->render('评论成功');
}
/**
* User: zhaoxin
* Date: 2019/11/7
* Time: 5:33 下午
* description 节点评价
*/
public function nodeMessage(){
$user = $this->validateToken();
$request = $this->selectParam([
'node_uuid','message_type','message_content'
]);
$this->check($request,'Engineering.node_message');
$data = OrderLogic::nodeMessage($request,$user);
if ($data === false) {
ResponseDirect(14040);
}
$this->render('评论成功');
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: xiezhixian
* Date: 2018/5/4
* Time: 上午11:05
*/
namespace app\api\controller\v1\web;
use app\api\logic\web\SendLogic;
use app\api\logic\web\UserLogic;
/**
* 所有资源类接都必须继承基类控制器
* 基类控制器提供了基础的验证,包含app_token,请求时间,请求是否合法的一系列的验证
* 在所有子类中可以调用$this->clientInfo对象访问请求客户端信息,返回为一个数组
* 在具体资源方法中,不需要再依赖注入,直接调用$this->request返回为请具体信息的一个对象
* date:2017-07-25
*/
class Send extends Base
{
/**
* 允许访问的方式列表,资源数组如果没有对应的方式列表,请不要把该方法写上,如user这个资源,客户端没有delete操作
*/
public $restMethodList = 'get|post|put|';
/*
* 发送验证码
*/
public function index()
{
$request = $this->selectParam(['mobile', 'sms_type']);
$request['define_sms_type'] = $request['sms_type'];
$this->check($request, 'Base.sendCompanySms');
$bool = UserLogic::checkUser($request['mobile']);
if(!empty($bool) and $request['sms_type']==='register'){
ResponseDirect(12062);//该手机已注册
}
if ($request['sms_type'] === 'bind' or $request['sms_type'] === 'pass' or $request['sms_type'] === 'reset' or $request['sms_type'] === 'getback') {
$bool = UserLogic::checkUser($request['mobile']);
if(empty($bool)){
ResponseDirect(12063);//该手机未注册
}
}
$info = SendLogic::SendSms($request['mobile'], $request['sms_type']);
if ($info === false) {
ResponseDirect(12064);//信息发送出现了一点小问题哟
}
//发送成功
$this->render(200);
}
/*
* 验证验证码
*/
public function validateTemp()
{
$request = $this->selectParam(['sms_type' => 'reset','code']);
$this->check($request, 'Base.validateCode');
//修改密码
$user_info = $this->validateToken();
$request['mobile'] = $user_info['mobile'];
$info = SendLogic::validateCode($request);
if ($info === false) {
ResponseDirect(11003);//验证码错误
}
$this->render("验证成功",200);
}
/*
* 验证验证码
*/
public function validateCode()
{
$request = $this->selectParam(['sms_type' => 'reset','code','mobile']);
$this->check($request, 'Base.validateWebCode');
$info = SendLogic::validateCode($request);
if ($info === false) {
ResponseDirect(11003);//验证码错误
}
$this->render("验证成功",200);
}
/**
* @author: zhaoxin
* @time: 2019年3月
* description 发送验证码
*/
public function sendCode()
{
$request = $this->selectParam(['mobile', 'sms_type' => 'pass']);
$request['sendPartnerSms'] = $request['sms_type'];
$this->check($request, 'Base.send_sms');
if($request['sms_type'] == 'reset'){
$user_info = $this->validateToken();
if($user_info['mobile'] != $request['mobile']){
$this->returnmsg(403, [], [],"", "", "手机号不一致");
}
}
$this->validateSmsType($request);
$info = SendLogic::SendSms($request['mobile'], $request['sms_type']);
if ($info === false) {
$this->returnmsg(403, [], [],"", "", "信息发送出现了一点小问题哟~");
}
$this->render('发送验证码成功',200);
}
}
<?php
/**
* Created by PhpStorm.
* User: ChiaHsiang
* Date: 2018/7/23
* Time: 14:15
*/
namespace app\api\controller\v1\web;
use app\api\controller\v1\web\Base;
use app\api\logic\web\SubaccountLogic;
class Subaccount extends Base
{
public $restMethodList = 'get|post|put|delete';
public function _initialize()
{
parent::_initialize();
//$this->hasPermission();
}
/*
* 列表
*/
public function index()
{
$user = $this->validateToken();
$data = SubaccountLogic::index($user);
$data !== false ? $this->render($data): $this->returnmsg(16290);
}
/*
* 详情
*/
public function read($id)
{
$this->validateToken();
$this->check(['uuid' => $id], 'Subaccount.uuid');
$data = SubaccountLogic::read($id);
$data !== false ? $this->render($data) : $this->returnmsg(16291);
}
//新增
public function save(){
$user = $this->validateToken();
//判断是否是主账号
if($user['account_grade']!==1){
ResponseDirect(16297);
}
$request = $this->selectParam(['name','mobile','position','password','order_uuid']);
$this->check($request,'Subaccount.save');
$request['parent_uuid'] = $user['uuid'];
$request['order_uuid'] = json_encode($request['order_uuid']);
$request['create_time'] = timeToDate();
$request['update_time'] = timeToDate();
$data = SubaccountLogic::save($request);
$data !== false ? $this->render("新增成功") : ResponseDirect(16292);
}
//更新
public function update($id){
$user = $this->validateToken();
//判断是否是主账号
if($user['account_grade']!==1){
ResponseDirect(16297);
}
$request = $this->selectParam(['uuid'=>$id,'name','mobile','position','password','order_uuid']);
$this->check($request,'Subaccount.update');
unset($request['uuid']);
$request['parent_uuid'] = $user['uuid'];
$request['order_uuid'] = json_encode($request['order_uuid']);
$request['update_time'] = timeToDate();
$data = SubaccountLogic::update($id,$request);
$data !== false ? $this->render('更新成功') : ResponseDirect(16293);
}
//删除
public function delete($id){
$this->validateToken();
$this->check(['uuid' => $id], 'Subaccount.uuid');
$data = SubaccountLogic::delete($id);
$data !== false ? $this->render('删除成功') : ResponseDirect(16294);
}
//订单列表
public function order_list(){
$user = $this->validateToken();
$data = SubaccountLogic::order_list($user,$this->pageIndex, $this->pageSize);
$data !== false ? $this->render($data) : ResponseDirect(16295);
}
}
\ No newline at end of file
<?php
namespace app\api\controller\v1\web;
use app\api\model\User as UserModel;
use app\api\model\UserSms;
use app\api\model\UserOauth;
use app\api\logic\web\SendLogic;
use app\api\logic\web\UserLogic;
use app\api\model\Config;
use app\common\tools\rongCloud;
use app\common\tools\wechatUtil;
use app\common\tools\qqUtil;
use app\common\tools\SendEmail;
use think\Controller;
use think\Validate;
/**
* 所有资源类接都必须继承基类控制器
* 基类控制器提供了基础的验证,包含app_token,请求时间,请求是否合法的一系列的验证
* 在所有子类中可以调用$this->clientInfo对象访问请求客户端信息,返回为一个数组
* 在具体资源方法中,不需要再依赖注入,直接调用$this->request返回为请具体信息的一个对象
* date:2017-07-25
*/
class User extends Base
{
/**
* 允许访问的方式列表,资源数组如果没有对应的方式列表,请不要把该方法写上,如user这个资源,客户端没有delete操作
*/
public $restMethodList = 'get|post|put|';
/**
* @author: star
* @time: 2019年9月
* description 验证邮箱验证码
*/
public function validate_email(){
$requestData = $this->selectParam(['email','code']);
$this->check($requestData, 'Base.email_verify');
$bool = \app\api\model\UserEmail::validateCode($requestData['email'],$requestData['code']);
if($bool === false){
ResponseDirect(11003);//验证码错误
}
$this->render('验证通过','200');
}
/**
* @author: star
* @time: 2019年9月
* description 发送邮箱验证码
*/
public function send_mail(){
$data = $this->selectParam(['email','type'=>1]);
//参数验证
$this->check($data, 'User.email');
if($data['type']==1){//注册或修改邮箱
//检测邮箱是否绑定账号
$bool = UserLogic::checkEmail($data['email']);
if($bool){
ResponseDirect(11007);//邮箱已绑定账号
}
}
if($data['type']==2){//找回密码
//检测邮箱是否绑定账号
$bool = UserLogic::checkEmail($data['email']);
if(empty($bool)){
ResponseDirect(12067);//邮箱未绑定账号
}
}
//生成验证码
$code = rand(10000,99999);
//发送邮件
$SendMail = new SendEmail();
//邮件模板
$html = $SendMail->emailTemp($code);
//发送邮件
$mail = config('email');
$bool = $SendMail->send($data['email'],$mail,'验证码',$html);
//写入邮件验证码表
if($bool){
$SendMail->email_code($code,$data['email']);
}
$bool !== false ? $this->render('验证码已发送~~') : ResponseDirect(12066);
}
/**
* @author: star
* @time: 2019年9月
* description 用户注册
*/
public function register()
{
$requestData = $this->selectParam(['account','password','email','name','mobile', 'province','city','county','detail','type',
'company_name','company_contact','company_mobile','business_licence','oauth_uuid','wechat_register']);
$this->check($requestData, 'User.web_save_user');
//邮箱是否绑定手机
$bool = UserLogic::checkEmail($requestData['email']);
if($bool){
ResponseDirect(12068);//邮箱已绑定账号
}
$requestData['uuid'] = uuid();
//$requestData['account'] = $requestData['mobile'];
unset($requestData['wechat_register']);
//unset($requestData['business_licence']);
if($requestData['type']==2){
$requestData['account_grade'] = 1;
$requestData['account'] = $requestData['account'];
}
$requestData['create_time'] = timeToDate();
$requestData['update_time'] = timeToDate();
$requestData['password'] = md5(md5($requestData['password']));
$bool = UserLogic::save($requestData);
$bool !== false ? $this->render('注册成功') : ResponseDirect(12009);
}
/**
* @author: zhaoxin
* @time: 2019年3月
* description 登录
*/
public function login()
{
$requestData = $this->selectParam(['mobile', 'password'=>'','code','state' => '','sms_type' => 'pass','login_type']);
if($requestData['login_type']==1){//账号密码登录
$this->check($requestData, 'UserLogin.account');
$bool = UserLogic::checkUser($requestData['mobile']);
if(empty($bool)){
ResponseDirect(12063);//手机未注册
}
}
if($requestData['login_type']==2){//短信验证码
$this->check($requestData, 'UserLogin.sms');
$bool = SendLogic::validateCode($requestData);
if($bool === false){
ResponseDirect(11003);//验证码错误
}
}
if($requestData['login_type']==3){//微信登录
$this->webOauthLogin();
}
$data = UserModel::build()->login($requestData);
$this->render($data);
}
/**
* @author: star
* @time: 2019年11月
* description 自定义授权验证
*/
public function selfDefineOauth(){
$requestData = $this->selectParam(
['code', 'state']
);
//PRIVATE_KEY
if ($requestData['state'] != md5(PRIVATE_KEY)) {
ResponseDirect('state验证失败',500);
}
$code = $requestData['code'];
try {
$app_id = config('wechat')['WebAppID'];
$app_secret = config('wechat')['WebAppSecret'];
$result = wechatUtil::getAccessToken($app_id, $app_secret, $code);
$result = json_decode($result, true);
if (!empty($result['errcode'])) {
$this->returnmsg(500, $data = [], $header = [], $type = "", "info', 'code error", $message = "无效code");
}
//$union_id = $result['unionid'];
$result = wechatUtil::getUserInfo($result['access_token'], $result['openid']);
//检测是否绑定微信
$bool = User::build()->where(['openid'=>$result['openid']])->find();
$requestData['login_type']=3;
return UserModel::build()->login($requestData);
} catch (Exception $e) {
$this->returnmsg(500, $data = [], $header = [], $type = "", "info', 'wechat error", $message = "服务器异常");
}
}
/**
* @author: zhaoxin
* @time: 2019年3月
* description 退出登录
*/
public function loginOut(){
$userInfo = $this->validateToken();
$bool = UserLogic::loginOut($userInfo['uuid']);
if($bool){
$this->render('退出成功',200);
}else{
ResponseDirect(12012);//退出失败
}
}
/**
* @author: Airon
* @time: 2017年9月7日
* description:PC微信网页获取登录二维码链接
* @return \think\response\Json
*/
public function wechatWebLoginUrl()
{
$requestData = $this->selectParam(
['callback_url']
);
$appId = config('wechat')['PublicAppID'];
$redirect_uri = urlencode($requestData['callback_url']);
$state = md5(PRIVATE_KEY);
$login_url = "https://open.weixin.qq.com/connect/qrconnect?appid={$appId}&redirect_uri={$redirect_uri}&response_type=code&scope=snsapi_login&state={$state}";
$this->render($login_url,200);
}
/**
* @author: Airon
* @time: 2019年5月
* description 获取微信用户信息
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getWechatInfo(){
$requestData = $this->selectParam(['jscode' => '']);
if(empty($requestData['jscode'])){
self::returnmsg(403, [], [], "", "param error", "请上传必填参数");
}
$data = UserLogic::getWechatInfo($requestData);
if($data){
$this->render($data);
}else{
ResponseDirect('授权失败',403);
}
}
/**
* @author: Airon
* @time: 2017年9月7日
* description:第三方登录 web wechat
* @return \think\response\Json
*/
public function webOauthLogin()
{
$requestData = $this->selectParam(
['code', 'state']
);
//PRIVATE_KEY
if ($requestData['state'] != md5(PRIVATE_KEY)) {
ResponseDirect('state验证失败',500);
}
$code = $requestData['code'];
try {
$app_id = config('wechat')['WebAppID'];
$app_secret = config('wechat')['WebAppSecret'];
$result = wechatUtil::getAccessToken($app_id, $app_secret, $code);
$result = json_decode($result, true);
if (!empty($result['errcode'])) {
$this->returnmsg(500, $data = [], $header = [], $type = "", "info', 'code error", $message = "无效code");
}
$union_id = $result['unionid'];
$result = wechatUtil::getUserInfo($result['access_token'], $result['openid']);
// $result = json_decode($result, true);
// if (!empty($result['errcode'])) {
// $this->returnmsg(500, $data = [], $header = [], $type = "", "info', 'access_token error", $message = "无效access_token");
// }
$user_info['oauth_type'] = 'wechat';
$user_info['pc_oauth_id'] = $result['openid'];
$user_info['nickname'] = $result['nickname'];
$user_info['avatar'] = $result['headimgurl'];
} catch (Exception $e) {
$this->returnmsg(500, $data = [], $header = [], $type = "", "info', 'wechat error", $message = "服务器异常");
}
$result = UserOauth::checkOauth($user_info['pc_oauth_id'],$user_info['oauth_type']);
//之前已完成授权,
if($result){
$this->render($result);
}
$user_info['uuid'] = uuid();
$user_info['union_id'] = $union_id;
$result = UserOauth::build()->save($user_info);
if($result){
$this->render(['oauth_uuid' => $user_info['uuid']]);
}
}
/**
* @author: zhaoxin
* @time: 2019年3月
* description 修改密码
*/
public function resetPassword(){
$userInfo = $this->validateToken();
$requestData = $this->selectParam(['password','sms_type' => 'reset','code']);
$this->check($requestData, 'Base.reset');
$requestData['mobile'] = $userInfo['mobile'];
$bool = SendLogic::validateCode($requestData);
if($bool === false){
$this->returnmsg(403, [], [], "", "", "验证码错误");
}
$userInfo['password'] = $requestData['password'];
$bool = CompanyModel::build()->updatePassword($userInfo,'reset');
if($bool === false){
$this->returnmsg(403,[],[],[],"","服务器错误,更改密码失败");
}
CompanySms::build()->update(['is_effected' => 0], ['mobile' => $requestData['mobile'], 'sms_type' => $requestData['sms_type'],'is_effected' => 1]);
$this->render('更改密码成功,请重新登陆',200);
}
/**
* @author: star
* @time: 2019年9月
* description 找回密码
*/
public function getBackPassword()
{
$requestData = $this->selectParam(['mobile','password','email','type']);
if($requestData['type']==1){//短信
$this->check($requestData, 'Base.mobile_validate');
$mobile = $requestData['mobile'];
}
if($requestData['type']==2){//邮箱
$this->check($requestData, 'Base.email_validate');
$mobile = UserModel::build()->getAccount($requestData['email']);
}
$data['password'] = $requestData['password'];
$bool = UserModel::build()->updatePassword($mobile,$requestData['password']);
if($bool === false){
ResponseDirect(12065);//服务器错误,更改密码失败
}
$this->render('更改密码成功,请重新登陆',200);
}
/**
* @author: star
* @time: 2019年9月
* description 微信解除绑定账户
*/
public function unbind()
{
$userInfo = $this->validateToken();
$data = UserLogic::unbind($userInfo);
$data !== false ? $this->render('已解除绑定') : ResponseDirect(12069);
}
/**
* @author: star
* @time: 2019年9月
* description 微信绑定账户
*/
public function bandWeChat()
{
$requestData = $this->selectParam(['mobile', 'code','sms_type' => 'bind ','openid','unionid','avatar','nickname','wechat_register'=>1]);
$this->check($requestData, 'User.bandWeChat');
$bool = UserLogic::checkUser($requestData['mobile']);
if(empty($bool)){
ResponseDirect(12063);//手机未注册
}
$bool = SendLogic::validateCode($requestData);
if($bool === false){
ResponseDirect(11003);//验证码错误
}
$bool = UserLogic::bandWeChat($requestData);
if($bool === false){
ResponseDirect(12013);//账号不存在
}
$this->render('账户绑定成功',200);
}
/**
* @author: star
* @time: 2019年9月
* description 个人信息
*/
public function baseInfo()
{
$data = $this->validateToken();
$data['postion'] = null;
if($data['type']==2 and $data['account_grade']==1){
$data['type']=2;
}
if($data['type']==2 and $data['account_grade']==2){
$data['type']=3;
$data['postion'] = \app\api\model\Subaccount::build()->where(['uuid'=>$data['uuid']])->value('position');
}
//$data['business_licence'] = json_decode($data['business_licence']);
$this->render($data);
}
/**
* @author: star
* @time: 2019年9月
* description 修改邮箱
*/
public function edit_email()
{
$user = $this->validateToken();
$request = $this->selectParam(['email']);
$this->check($request, 'User.email');
$data = UserLogic::edit_email($request,$user);
$data !== false ? $this->render('邮箱修改成功') : ResponseDirect(11006);
}
/**
* @author: star
* @time: 2019年9月
* description 个人信息
*/
public function edit_info()
{
$request = $this->selectParam([
'type','name','mobile','email','province','city',
'county','detail','position',
'company_name','company_mobile','company_contact','business_licence',
'uuid'
]);
if($request['type']==1){
$this->check($request, 'User.user_type');
}
if($request['type']==2){
$this->check($request, 'User.company_type');
}
$data = UserLogic::edit_info($request);
$data !== false ? $this->render('编辑成功') : $this->returnmsg(16265);
}
/**
* @author: star
* @time: 2019年9月
* description 企业详情
*/
public function company_detail()
{
$userInfo = $this->validateToken();
$data['money'] = $userInfo['money'];
$data['freeze_money'] = $userInfo['freeze_money'];
$data['freeze_integrity_money'] = $userInfo['freeze_integrity_money'];
$this->render($data,200);
}
/**
* @author: star
* @time: 2019年9月
* description 常见问题
*/
public function question(){
$listInfo['data'] = Faq::build()->where(['device' => '2'])->order('update_time desc')->select();
if($listInfo){
$this->render($listInfo,200);
}else{
$this->render('暂无常见问题',200);
}
}
/**
* @author: zhaoxin
* @time: 2019年3月
* description 关于我们
*/
public function about(){
$info = Config::build()->where(['key' => 'about_us_pc'])->field('value,remark',false)->find();
if($info){
$this->render($info,200);
}else{
$this->render('暂无常见问题',200);
}
}
/**
* @author: zhaoxin
* @time: 2019年4月
* description 消息中心
*/
public function messageList(){
$userInfo = $this->validateToken();
$requestData = $this->selectParam(['page_index' => '1','message_status'=>'0']);
$this->check($requestData, 'Position.message');
$list = UserLogic::messageList($requestData,$userInfo['uuid']);
if($list){
$this->render($list,200);
}else{
$this->render('暂无悬赏币明细',200);
}
}
/**
* @author: zhaoxin
* @time: 2019年4月
* description 消息中心详情
*/
public function messageInfo(){
$userInfo = $this->validateToken();
$requestData = $this->selectParam(['uuid']);
$this->check($requestData, 'Position.uuid');
$info = UserLogic::messageInfo($requestData,$userInfo['uuid']);
if($info){
$this->render($info,200);
}else{
ResponseDirect('消息信息不存在',403);
}
}
}
<?php
/**
* Created by PhpStorm.
* User: ChiaHsiang
* Date: 2018/7/23
* Time: 14:15
*/
namespace app\api\controller\v1\web;
use app\api\logic\web\UserFeedBackLogic;
use app\api\controller\v1\web\Base;
class UserFeedBack extends Base
{
public $restMethodList = 'get|post|delete|put';
public function _initialize()
{
parent::_initialize();
//$this->hasPermission();
}
/*
* 新增
*/
public function save()
{
$user = $this->validateToken();
$requestData = $this->selectParam(['title','content']);
$this->check($requestData, 'Example.feed_back');
$requestData['uuid'] = uuid();
$requestData['user_uuid'] = $user['uuid'];
$requestData['create_time'] = timeToDate();
$requestData['update_time'] = timeToDate();
$bool = UserFeedBackLogic::save($requestData);
$bool !== false ? $this->render('提交成功'): $this->returnmsg(16230);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: mac
* Date: 2019-09-19
* Time: 11:34
*/
namespace app\api\logic\app;
use app\api\model\Engineer;
use app\api\model\EngineerForm;
use app\api\model\EngineeringGrade;
use app\api\model\EngineeringRegisters;
use app\api\model\EngineerOauth;
use app\api\model\EngineerToken;
use app\api\model\ServiceNetwork;
use app\api\model\Target;
use app\common\tools\wechatUtil;
use app\common\tools\WXBizDataCrypt;
class EngineerLogic{
/**
* User: zhaoxin
* Date: 2019-09-20
* Time: 14:46
* description
* @param $user_info
* @return mixed
*/
public static function index($user_info){
$service_name = ServiceNetwork::build()->where(['uuid' => $user_info['service_uuid']])->value('name');
$user_info['service_name'] = empty($service_name) ? '暂无' : $service_name;
$grade_name = EngineeringGrade::build()
->where(['praise' => ['<=',$user_info['praise_number'],'order' => ['<=',$user_info['order_number']]]])
->order(['praise' => 'desc','order' => 'desc'])
->value('title');
// ->field(['title'])
// ->limit(1,1)
// ->select();
$user_info['grade_name'] = empty($grade_name) ? '暂无' : $grade_name;
$user_info['service_day'] = json_decode($user_info['service_day']);
foreach ($user_info['service_day'] as $k => &$v){
$v = [
'name' => EngineeringRegisters::build()->where(['uuid' => $v])->value('content'),
'uuid' => $v
];
}
$user_info['service_time'] = json_decode($user_info['service_time']);
foreach ($user_info['service_time'] as $k => &$v){
$v = [
'name' => EngineeringRegisters::build()->where(['uuid' => $v])->value('content'),
'uuid' => $v
];
}
$user_info['service_skill'] = json_decode($user_info['service_skill']);
foreach ($user_info['service_skill'] as $k => &$v){
$v = [
'name' => EngineeringRegisters::build()->where(['uuid' => $v])->value('content'),
'uuid' => $v
];
}
$user_info['other_img'] = json_decode($user_info['other_img']);
unset($user_info['password']);
unset($user_info['is_delete']);
return $user_info;
}
/**
* User: zhaoxin
* Date: 2019-09-19
* Time: 17:47
* description 小程序授权
* @param $requestData
* @return array|int
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function oauth($requestData){
$config = config('wechat');
$openIdInfo = self::getOpenId($config['XcxAppID'], $config['XcxAppSecret'],$requestData['jscode']);
$openIdInfo = json_decode($openIdInfo, true);
if (!empty($openIdInfo['errcode'])) {
ResponseDirect(13002);
}
$pc = new WXBizDataCrypt($config['XcxAppID'], $openIdInfo['session_key']);
$errCode = $pc->decryptData($requestData['encryptedData'], $requestData['vi'], $result);
if ($errCode != 0) {
return $errCode;
}
$result = json_decode($result, true);
$oauth_info = EngineerOauth::build()
->where(['oauth_id' => $openIdInfo['openid']])
->find();
//已授权并绑定用户直接登陆
if(!empty($oauth_info['engineer_uuid'])){
$engineer_info = Engineer::build()
->where(['uuid' => $oauth_info['engineer_uuid']])
->find();
if ($engineer_info['is_banned']) {
ResponseDirect(12021);
}
$token = EngineerToken::storeToken($oauth_info['engineer_uuid']);
$users['token'] = $token;
$users['login'] = 1;//直接登陆
return $users;
}
//已授权并绑定了手机号,但未填写直接登陆
if(!empty($oauth_info['mobile'])){
$users['login'] = 2;//进行添加信息操作
$users['oauth_uuid'] = $oauth_info['uuid'];//进行添加信息操作
return $users;
}
//第一次进行授权
if(empty($oauth_info)){
$data = [];
$data['uuid'] = uuid();
$data['oauth_type'] = "xcx";
$data['oauth_id'] = $openIdInfo['openid'];
$data['nickname'] = $result['nickName'];
$data['avatar'] = $result['avatarUrl'];
$data['sex'] = $result['gender'];
$data['union_id'] = $result['unionId'];
$data['create_time'] = timeToDate();
$bool = EngineerOauth::build()
->insert($data);
if($bool == false){
ResponseDirect(13003);
}
$oauth_info['uuid'] = $data['uuid'];
}
return ['login' => 3,'oauth_uuid' => $oauth_info['uuid']];//需要进行绑定授权步骤
}
/**
* User: zhaoxin
* Date: 2019-09-19
* Time: 17:06
* description 小程序获取openid
* @param $appId
* @param $appSecret
* @param $js_code
* @return bool
*/
public static function getOpenId($appId, $appSecret,$js_code)
{
if (empty($appId) || empty($appSecret)) {
return false;
}
$url = "https://api.weixin.qq.com/sns/jscode2session?"
. "?grant_type=authorization_code&appid={$appId}&secret={$appSecret}&js_code={$js_code}";
$result = wechatUtil::getCurl($url);
return $result;
}
/**
* User: zhaoxin
* Date: 2019-09-20
* Time: 09:59
* description
* @param $requestData
* @return array
* @throws \think\Exception
*/
public static function bandMobile($requestData)
{
$config = config('wechat');
$openIdInfo = self::getOpenId($config['XcxAppID'], $config['XcxAppSecret'],$requestData['jscode']);
$openIdInfo = json_decode($openIdInfo, true);
if (!empty($openIdInfo['errcode'])) {
ResponseDirect(13002);
}
$pc = new WXBizDataCrypt($config['XcxAppID'], $openIdInfo['session_key']);
$errCode = $pc->decryptData($requestData['encryptedData'], $requestData['vi'], $result);
if ($errCode != 0) {
return $errCode;
}
$result = json_decode($result, true);
$count = Engineer::build()->checkUser($result['phoneNumber']);
if($count > 0){
ResponseDirect(13000);
}
$bool = EngineerOauth::build()
->where(['oauth_id'=>$openIdInfo['openid']])
->update(['mobile' => $result['phoneNumber'],'update_time' => timeToDate()]);
if($bool == false){
ResponseDirect(13004);
}
return ['login' => 2,'oauth_uuid' => $requestData['oauth_uuid']];
}
/**
* User: zhaoxin
* Date: 2019-09-20
* Time: 11:17
* description
* @param $requestData
* @return Engineer
* @throws \think\Exception
*/
public static function resetPassword($requestData){
$count = Engineer::build()->checkUser($requestData['mobile']);
if($count <= 0){
ResponseDirect(13008);
}
return Engineer::build()
->where(['mobile' => $requestData['mobile']])
->update(['password' => md5(md5($requestData['password'])),'update_time' => timeToDate()]);
}
public static function plans($requestData,$user,$page_index,$page_size){
$where = ['service_uuid' => $user['service_uuid']];
if (!empty($requestData['start_time']) && !empty($requestData['end_time'])) {
$start_time = date('Y-m-01 00:00:00',strtotime($requestData['start_time']));
$end_time = date('Y-m-31 23:59:59',strtotime($requestData['end_time']));
$where['t.start_time|t.end_time'] = ['between time',[$start_time,$end_time]];
}
$list = Target::build()
->alias('t')
->join('engineering_target e_t','e_t.uuid = t.target_uuid')
->where($where)
->field([
't.uuid','t.start_time','t.end_time','t.title','e_t.title target_time',
])
->paginate(['list_rows' => $page_size, 'page' => $page_index]);
return $list;
}
public static function planInfo($uuid){
return Target::build()
->where(['uuid' => $uuid])
->field(['title','content'])
->find();
}
public static function saveFormId($requestData,$userInfo){
if (empty($requestData['form_id'])){
return false;
}
return EngineerForm::build()
->insert([
'uuid' => uuid(),
'engineer_uuid' => $userInfo['uuid'],
'form_id' => $requestData['form_id'],
'expire_time' => timeToDate(time() + 604800)
]);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: mac
* Date: 2019-09-20
* Time: 14:52
*/
namespace app\api\logic\network;
use app\api\model\Engineer;
use app\api\model\EngineeringRegisters;
use app\api\model\EngineerOauth;
use think\Session;
class EngineerLogic
{
private $network_info;
public function __construct()
{
$this->network_info = Session::get('network_info');
}
public function index($request,$page_index,$page_size){
$where = ['e.is_delete' => '0','service_uuid' => $this->network_info['uuid']];
if (!empty($request['keyword'])){
$where['e.name|e.mobile'] = ['like',"%".$request['keyword']."%"];
}
if (!empty($request['province'])){
$where['e.province'] = ['like',"%".$request['province']."%"];
}
if (!empty($request['city'])){
$where['e.city'] = ['like',"%".$request['city']."%"];
}
if (!empty($request['county'])){
$where['e.county'] = ['like',"%".$request['county']."%"];
}
if (!empty($request['service_type'])){
$where['e.service_type'] = $request['service_type'];
}
if (in_array($request['is_authentication'],['0','1'])){
$where['e.is_authentication'] = $request['is_authentication'];
}
if($request['user_type'] == '1'){
$where['e.is_authentication'] = '1';
$where['e.is_banned'] = '0';
$where['e.type'] = ['in',['1','3']];
}
$data = Engineer::build()
->alias('e')
->where($where)
->field([
'e.name','e.mobile','e.province','e.city','e.county','e.service_type','e.service_uuid service_name',
'e.create_time', 'e.is_authentication','e.uuid'
])
->order(['e.create_time' => 'desc']);
if($request['is_export'] == '1'){
$data = collection($data->select())->toArray();
$exports = [];
foreach ($data as $k => $v){
$export = [
'id' => $k+1,
'name' => $v['name'],
'mobile' => $v['mobile'].' ',
'address' => $v['province'].$v['city'].$v['county'],
'service_type' => ($v['service_type'] == '1') ? '工程师' : '工程队',
'create_time' => $v['create_time'],
'is_authentication' => ($v['is_authentication'] == '1') ? '是':'否'
];
$exports[] = array_values($export);
}
return $exports;
}
$data = $data->paginate(['list_rows' => $page_size, 'page' => $page_index]);
return $data;
return $data;
}
public function read($uuid){
$user_info = Engineer::build()->where(['uuid' => $uuid,'service_uuid' => $this->network_info['uuid']])->find();
$user_info = $user_info->toArray();
foreach ($user_info['service_day'] as $k => &$v){
$v = [
'name' => EngineeringRegisters::build()->where(['uuid' => $v])->value('content'),
'uuid' => $v
];
}
foreach ($user_info['service_time'] as $k => &$v){
$v = [
'name' => EngineeringRegisters::build()->where(['uuid' => $v])->value('content'),
'uuid' => $v
];
}
foreach ($user_info['service_skill'] as $k => &$v){
$v = [
'name' => EngineeringRegisters::build()->where(['uuid' => $v])->value('content'),
'uuid' => $v
];
}
$user_info['oauth_info'] = EngineerOauth::build()
->where(['engineer_uuid' => $uuid])
->field(['nickname','mobile','avatar'])
->find();
return $user_info;
}
public static function delete($uuid){
return Engineer::build()->where(['uuid' => $uuid])->update(['is_delete' => '1','update_time' => timeToDate()]);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: mac
* Date: 2019-04-13
* Time: 11:03
*/
namespace app\api\logic\network;
use app\api\model\Operation;
use app\api\model\SellerAdmin;
use app\api\model\SellerGroup;
use app\api\model\SellerIdentityGroup;
use app\api\model\GroupAdmin;
use app\api\model\Admin;
use app\api\model\SellerGroupMenu;
use app\api\model\SellerMenus;
use app\common\tools\wechatUtil;
use think\Db;
use think\Session;
class GroupLogic
{
private $sellerUuid;
public function __construct()
{
$sellerInfo = Session::get('seller_info');
$this->sellerUuid = $sellerInfo['uuid'];
}
/**
* @author: Airon
* @time: 2019年4月
* description
* @param $page_index
* @param $page_size
* @return \think\Paginator
* @throws \think\exception\DbException
*/
public function index($requestData,$page_index, $page_size) {
$where['seller_uuid'] = $this->sellerUuid;
$where['type'] = '0';
if(!empty($requestData['keyword'])){
$where['name|account|mobile'] = ['like',"%{$requestData['keyword']}%"];
}
return SellerAdmin::build()
->where($where)
->field(['uuid', 'account','name','mobile'])
->paginate(['list_rows' => $page_size, 'page' => $page_index]);
}
/**
* @author: Airon
* @time: 2019年4月
* description
* @param $id
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function read($id) {
return SellerIdentityGroup::build()
->where(['uuid' => $id])->field(['name'])->find();
}
public static function save($data) {
// $data['uuid'] = uuid();
// $data['create_time'] = timeToDate();
$group_uuid = $data['uuid'];
$menus= array_unique($data['menu_uuid']);
$group_menu = [];
foreach ($menus as $menu_uuid) {
$group_menu[] = [
'group_uuid' => $group_uuid,
'menu_uuid' => $menu_uuid,
'create_time' => timeToDate(),
];
}
Db::startTrans();
$bool_1 = SellerGroupMenu::build()
->where([
'group_uuid' => $group_uuid,
])->delete();
$bool_2 = SellerGroupMenu::build()
->insertAll($group_menu);
if ($bool_1 !== false and $bool_2 !== false) {
Db::commit();
return true;
}
Db::rollback();
return false;
}
public static function update($requestData) {
$requestData['password'] = MD5(MD5($requestData['password']));
return SellerAdmin::build()->except('uuid')->save($requestData,['uuid' => $requestData['uuid']]);
}
public static function menuInfo($uuid){
$menu = SellerAdmin::build()
->alias('S_A')
->join('seller_group_menus S_G_M', 'S_G_M.group_uuid = S_A.uuid')
->join('seller_menus M_B', 'M_B.uuid = S_G_M.menu_uuid')
->where(['S_A.uuid' => $uuid])
->field([
'M_B.uuid',
'M_B.parent_uuid',
])->select();
if(empty($menu)){
return ['menu_bar' => ''];
}
$menu = collection($menu)->toArray();
$parent = SellerMenus::build()
->where(['parent_uuid' => 0])
->field(['uuid', 'parent_uuid'])
->select();
$parent = collection($parent)->toArray();
$data = [];
foreach ($parent as $item) {
$data[$item['uuid']] = $item;//目录字典
}
$parent_array = array_column($parent, 'uuid');
$lists = [];
foreach ($menu as $item) {
$lists[$item['parent_uuid']][] = $item;
}
$result = $lists[0];//设置一级菜单
foreach ($lists as $k => $v) {
if ($k !== 0) {//判断是否为一级
$temp = $v;
foreach ($temp as $key => $value) {//进行二级菜单子集判断
if (array_key_exists($value['uuid'], $lists)) {
$temp[$key]['children'] = $lists[$value['uuid']];
}
}
foreach ($result as $key=>$value){
if($value['uuid'] == $k){
$result[$key]['children'] = $temp;
}
}
continue;
}
}
return [
'menu_bar' => $result,
];
}
public static function delete($id) {
Db::startTrans();
$bool_2 = SellerGroupMenu::build()
->where(['group_uuid' => $id])->delete();
$bool_3 = SellerAdmin::build()
->where(['uuid' => $id])->delete();
if ($bool_2 !== false and $bool_3 !== false) {
Db::commit();
return true;
}
Db::rollback();
return false;
}
/**
* @author: Airon
* @time: 2019年4月
* description
* @param $id
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function getPermission($id) {
$data = SellerGroupMenu::build()->where(['group_uuid' => $id])->field(['menu_uuid'])->select();
if (!empty($data)) {
$result = [];
foreach ($data as $datum) {
$result[] = $datum['menu_uuid'];
}
return array('second_menu_uuid' => $result);
}
return array('second_menu_uuid' => []);
}
/**
* 验证是否有访问权限
*/
public static function hasPermission($admin_uuid, $controller, $action){
$result = SellerAdmin::build()
->alias('S_A')
->join('seller_group_menus S_G_M', 'S_G_M.group_uuid = S_A.uuid')
->join('seller_menus M_B', 'M_B.uuid = S_G_M.menu_uuid')
->where(['S_A.uuid' => $admin_uuid])
->field([
'M_B.authority_url',
])->select();
$i = 0;
$access_url = "/".$controller;
if (!empty($action)) {
$access_url = $access_url."/".$action;
}
foreach ($result as $value) {
if (strtolower($value['authority_url']) == $access_url) {
$i++;
}
}
if($i == 0) {
return false;
}
return true;
}
/*
* 添加商家后台管理员
*/
public function addSellerAdmin($requestData){
$requestData['password'] = MD5(MD5($requestData['password']));
//新增
if(empty($requestData['menu_uuid'])){
$count = SellerAdmin::build()->where(['account' => $requestData['account']])->count();
if($count >= 1){
ResponseDirect('管理员账号重复,请重新编辑',403);
}
$requestData['uuid'] = uuid();
$requestData['seller_uuid'] = $this->sellerUuid;
$requestData['create_time'] = timeToDate();
return SellerAdmin::build()->insert($requestData);
}
//编辑
else{
return SellerAdmin::build()->except('menu_uuid')->save($requestData,['uuid' => $requestData['menu_uuid']]);
}
}
/*
* 添加运营人员
*/
public function operation_add($requestData){
$requestData['uuid'] = uuid();
$requestData['seller_uuid'] = $this->sellerUuid;
$requestData['create_time'] = timeToDate();
return Operation::build()->insert($requestData);
}
/*
* 编辑运营人员
*/
public static function operation_update($requestData){
return Operation::build()->where('uuid',$requestData['uuid'])
->update(['mobile'=>$requestData['mobile'],'nickname'=>$requestData['nickname'],'update_time'=>timeToDate()]);
}
/*
* 删除运营人员
*/
public static function operation_del($requestData){
return Operation::build()->where('uuid',$requestData['uuid'])
->delete();
}
/**
* @author: Airon
* @time: 2019年5月
* description 获取微信用户信息
* @param $data
* @return array|bool
*/
public static function getWechatInfo($data)
{
$config = config('wechat');
$result = wechatUtil::getAccessToken($config['PublicAppID'], $config['PublicAppSecret'], $data['jscode']);
$result = json_decode($result, true);
if (!empty($result['errcode'])) {
ResponseDirect($result['errmsg']);
}
$user_info = wechatUtil::getUserInfo($result['access_token'], $result['openid']);
if (empty($user_info)) {
ResponseDirect("获取用户信息失败");
}
$user_info = json_decode($user_info, true);
$user_info['openid'] = $result['openid'];
$user_info['unionid'] = empty($result['unionid']) ? "" : $result['unionid'];
$bool = Operation::build()->where(['oauth_id'=>$user_info['openid'],'seller_uuid'=>$data['seller_uuid']])->find();
if($bool){
ResponseDirect('该账号已添加');
}
$add = [
'uuid'=>uuid(),
'seller_uuid'=>$data['seller_uuid'],
'oauth_id' => $user_info['openid'],
'wechat_name'=>$user_info['nickname'],
'avatar' =>$user_info['headimgurl'],
'unionid' => $user_info['unionid'],
'create_time' =>timeToDate()
];
$bool=Operation::build()->insert($add);
if(!$bool){
ResponseDirect("添加失败");
}
return $user_info;
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: mac
* Date: 2019-04-12
* Time: 18:19
*/
namespace app\api\logic\network;
use app\api\model\ServiceNetworkGroupMenus;
use app\api\model\ServiceNetworkMenus;
class MenuBarLogic
{
private static function showCat($cats, $root)
{
$tree = [];
if (isset($cats[$root])) {
foreach ($cats[$root] as $k => $cat) {
$tree[$k] = $cat;
$children = self::showCat($cats, $cat['uuid']);
$tree[$k]['children'] = $children;
}
}
return $tree;
}
/**
* @author: Airon
* @time: 2019年4月
* description
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function index()
{
$result = ServiceNetworkMenus::build()
->order(['sort' => 'DESC'])
->select();
$result = collection($result)->toArray();
$cats = [];
foreach ($result as $cat) {
$cats[$cat['parent_uuid']][] = $cat;
}
return ['root' => self::showCat($cats, '0')];
}
public static function save($data)
{
$data['uuid'] = uuid();
$data['create_time'] = timeToDate();
if (empty($data['parent_uuid'])) {
$data['parent_uuid'] = '0';
}
return ServiceNetworkMenus::build()->insert($data);
}
public static function update($data)
{
return ServiceNetworkMenus::build()->where(['uuid' => $data['uuid']])->update($data);
}
public static function delete($id)
{
$bool_2 = ServiceNetworkGroupMenus::build()
->where([
'menu_uuid' => $id,
])->delete();
return ServiceNetworkMenus::build()
->where([
'uuid' => $id,
])->delete();
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: mac
* Date: 2019-09-21
* Time: 10:14
*/
namespace app\api\logic\network;
use app\api\model\ServiceNetwork;
use app\api\model\ServiceNetworkAdmin;
use app\api\model\ServiceNetworkInfo;
use app\api\model\ServiceNetworkMenus;
use app\api\model\ServiceNetworkToken;
use think\Session;
class NetworkLogic
{
private $network_info;
public function __construct()
{
$this->network_info = Session::get('network_info');
}
/**
* User: zhaoxin
* Date: 2019-09-21
* Time: 11:07
* description
* @param string $account
* @param string $password
* @return array|bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function login($account = '', $password = ''){
$user = ServiceNetworkAdmin::build()
->alias('S_A')
->join('service_network S','S.uuid = S_A.network_uuid')
->where(['S_A.account' => $account, 'S_A.password' => md5(md5($password))])
->field(['S_A.uuid','S_A.network_uuid','S.name','S_A.type'])
->find();
if (!empty($user)) {
$token = ServiceNetworkToken::storeToken($user['network_uuid'],$user['uuid']);
$menu = ServiceNetworkAdmin::build()
->alias('S_A')
->join('service_network_group_menus S_G_M', 'S_G_M.group_uuid = S_A.uuid')
->join('service_network_menus M_B', 'M_B.uuid = S_G_M.menu_uuid')
->where(['S_A.uuid' => $user['uuid']])
->field([
'M_B.uuid',
'M_B.parent_uuid',
'M_B.name',
'M_B.url',
'M_B.classes'
])
->order(['M_B.sort' => 'DESC'])
->select();
if(empty($menu)){
return [
'user_info' => $user,
'token' => $token,
'menu_bar' => '',
];
}
$menu = collection($menu)->toArray();
$parent = ServiceNetworkMenus::build()
->where(['parent_uuid' => 0])
->field(['uuid', 'name', 'parent_uuid', 'url', 'classes'])
->select();
$parent = collection($parent)->toArray();
$data = [];
foreach ($parent as $item) {
$data[$item['uuid']] = $item;//目录字典
}
$parent_array = array_column($parent, 'uuid');
$lists = [];
foreach ($menu as $item) {
$lists[$item['parent_uuid']][] = $item;
}
$result = $lists[0];//设置一级菜单
foreach ($lists as $k => $v) {
if ($k !== 0) {//判断是否为一级
$temp = $v;
foreach ($temp as $key => $value) {//进行二级菜单子集判断
if (array_key_exists($value['uuid'], $lists)) {
$temp[$key]['children'] = $lists[$value['uuid']];
}
}
foreach ($result as $key=>$value){
if($value['uuid'] == $k){
$result[$key]['children'] = $temp;
}
}
continue;
}
}
return [
'user_info' => $user,
'token' => $token,
'menu_bar' => $result,
];
}
return false;
}
/**
* User: zhaoxin
* Date: 2019-09-21
* Time: 11:07
* description
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function info(){
$data = ServiceNetwork::build()
->where(['uuid' => $this->network_info['uuid']])
->field([
'name','province','city','county','address','contact_name','contact_mobile',
'introduce','uuid','status'
])
->find();
return $data;
}
public static function read($uuid){
$data = ServiceNetworkInfo::build()
->where(['network_uuid' => $uuid])
->field([
'name','province','city','county','address','contact_name','contact_mobile',
'introduce'
])
->find();
return $data;
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: mac
* Date: 2019-09-23
* Time: 18:01
*/
namespace app\api\logic\network;
use app\api\model\Engineer;
use app\api\model\MessageUser;
use app\api\model\Order;
use app\api\model\OrderExcel;
use app\api\model\Orderhistory;
use app\api\model\OrderNode;
use app\api\model\ServiceNetwork;
use think\Db;
use think\Session;
class OrderLogic
{
private $network_info;
public function __construct()
{
$this->network_info = Session::get('network_info');
}
public function index($request,$page_index,$page_size){
$where = ['service_uuid' => $this->network_info['uuid']];
if (!empty($request['keyword'])) {
$where['o.contact_name|o.code|contact_mobile'] = ['like',"%{$request['keyword']}%"];
}
if(!empty($request['engineering_type'])) {
$where['o.type'] = $request['engineering_type'];
}
switch ($request['order_status']){
case '1'://已下单
$where['o.pay_status'] = '0';
// $where['o.is_assgin'] = '2';
$where['o.status'] = '0';
break;
case '2'://已指派
$where['o.pay_status'] = '0';
// $where['o.is_assgin'] = '2';
$where['o.status'] = '1';
break;
case '3'://待确定
// $where['o.is_assgin'] = '2';
$where['o.pay_status'] = ['in',['1','2']];
$where['o.status'] = '1';
break;
case '4'://实施中
$where['o.pay_status'] = '2';
$where['o.status'] = '2';
$where['o.is_check'] = '0';
break;
case '5'://
$where['o.pay_status'] = '2';
$where['o.status'] = '2';
$where['o.is_check'] = '1';
break;
case '6'://已完成
$where['o.pay_status'] = '2';
$where['o.status'] = '3';
break;
case '7'://已取消
$where['o.pay_status'] = '3';
break;
default:
ResponseDirect(14017);
break;
}
$data = Order::build()
->alias('o')
->join('engineering e','e.uuid = o.engineering_uuid')
->where($where)
->field([
'o.uuid','o.code','e.name','o.contact_name','o.contact_mobile','o.type',
'o.update_time','o.province','o.city','o.county','o.address','o.uuid is_need'
])
->order(['o.update_time' => 'desc']);
if($request['is_export'] == '1'){
$data = collection($data->select())->toArray();
$exports = [];
foreach ($data as $k => $v){
$export = [
'id' => $k+1,
'code' => $v['code'].' ',
'contact_name' => $v['contact_name'],
'contact_mobile' => $v['contact_mobile'].' ',
'address' => $v['province'].$v['city'].$v['county'],
'name' => $v['name'],
'create_time' => $v['update_time'],
'is_need' => ($v['is_need'] == '1') ? '是':'否'
];
$exports[] = array_values($export);
}
return $exports;
}
$data = $data->paginate(['list_rows' => $page_size, 'page' => $page_index]);
return $data;
}
public function read($id){
$count = Order::build()
->where(['uuid' => $id,'service_uuid' => $this->network_info['uuid']])
->count();
if($count <= 0){
ResponseDirect(14024);
}
$info['user_info'] = Order::build()
->alias('o')
->join('user u','u.uuid = o.user_uuid')
->where(['o.uuid' => $id])
->field([
'u.type','u.name','u.mobile','u.email','u.province','u.county','u.city',
'u.detail','u.company_name','u.company_contact','u.company_mobile','u.business_licence',
'o.engineer_uuid'
])
->find();
$info['order_info'] = Order::build()
->alias('o')
->join('engineering e','e.uuid = o.engineering_uuid')
->where(['o.uuid' => $id])
->field([
'o.type','e.name','o.contact_name','o.contact_mobile','o.province','o.city','o.county',
'o.describe','o.pay_status','o.status service_order_status','o.uuid','o.is_message',
'o.is_check','o.contract_money','o.contract_img'
])
->find();
$info['excel_info'] = OrderExcel::build()
->where(['order_uuid' => $id])
->field(['uuid','name','url','create_time'])
->order(['create_time' => 'DESC'])
->select();
$info['node_info'] = OrderNode::build()
->where(['order_uuid' => $id])
->field(['name','time','uuid'])
->order(['time' => 'ASC'])
->select();
$info['assgin_info'] = Engineer::build()
->where(['uuid' => $info['user_info']['engineer_uuid']])
->field([
'service_type','uuid service_name','name','mobile','province','city','county'
])
->find();
if($info['order_info']['type'] == '2'){
$info['contract_info']['money'] = $info['order_info']['contract_money'];
$info['contract_info']['img'] = $info['order_info']['contract_img'];
}
unset($info['order_info']['contract_money']);
unset($info['order_info']['contract_img']);
return $info;
}
public function appoint($request){
//直接指派给工程师
$user_info = Engineer::build()
->where(['uuid' => $request['appoint_uuid']])
->field(['uuid','is_authentication','type','service_uuid','name','mobile'])
->find();
if(empty($user_info)){
ResponseDirect(13014);
}
$data['service_uuid'] = $this->network_info['uuid'];
$data['engineer_uuid'] = $request['appoint_uuid'];
$data['status'] = '1';
$data['update_time'] = timeToDate();
//指派信息
$order_history = [
'uuid' => uuid(),
'order_uuid' => $request['order_uuid'],
'pay_status' => '0',
'status' => '1',
'is_check' => '0',
'name' => $user_info['name'],
'mobile' => $user_info['mobile'],
'create_time' => timeToDate(),
];
Db::startTrans();
$bool = Order::build()
->where(['uuid' => $request['order_uuid']])
->update($data);
if($bool == false){
ResponseDirect(14023);
}
$bool = Orderhistory::build()
->insert($order_history);
if($bool == false){
Db::rollback();
ResponseDirect(14015);
}
$bool = MessageUser::build()
->insert([
'uuid' => uuid(),
'user_uuid' => $user_info['uuid'],
'title' => '订单通知',
'content' => '您的订单已指派,请保持电话通畅,方便工作人员联系您!',
'other_uuid' => $request['order_uuid'],
'message_type' => '1',
'create_time' => timeToDate(),
]);
if($bool == false){
Db::rollback();
ResponseDirect(14059);
}
Db::commit();
return true;
}
public static function confirmAppoint($uuid){
$order_info = Order::build()
->where(['uuid' => $uuid])
->field(['engineer_uuid','contact_name','contact_mobile'])
->find();
if(empty($order_info)){
ResponseDirect(14027);
}
if(empty($order_info['engineer_uuid'])){
ResponseDirect(14026);
}
$count = OrderExcel::build()
->where(['order_uuid' => $uuid])
->count();
if($count <= 0){
ResponseDirect(14028);
}
Db::startTrans();
$bool = Order::build()
->where(['uuid' => $uuid])
->update([
'pay_status' => '1',
'update_time' => timeToDate()
]);
if($bool == false){
ResponseDirect(14019);
}
$bool = Orderhistory::build()
->insert([
'uuid' => uuid(),
'order_uuid' => $uuid,
'pay_status' => '1',
'status' => '1',
'is_check' => '0',
'name' => $order_info['contact_name'],
'mobile' => $order_info['contact_mobile'],
'create_time' => timeToDate()
]);
if($bool == false){
DB::rollback();
ResponseDirect(14015);
}
Db::commit();
return true;
}
}
\ No newline at end of file
<?php
/**
*
* Created by PhpStorm.
* User: fenggaoyuan
* Email: 253869997@qq.com
* Date: 2018/7/26
* Time: 11:35
*/
namespace app\api\logic\network;
use app\api\model\MessageUser;
use app\api\model\User;
use app\api\model\UserMoney;
use app\api\model\UserRecharge;
use app\api\model\ServiceWithdrawal;
use app\api\model\Withdrawal;
use app\api\model\Config;
use app\api\model\ServiceNetwork;
use think\Db;
use think\Exception;
class WithdrawalLogic
{
public static function index($user,$request,$page,$size){
$where['sw.service_uuid'] =['eq',$user['uuid']];
if (!empty($data['start_time']) and !empty('end_time')) {
$start_time = date('Y-m-d 00:00::00',strtotime($data['start_time']));
$end_time = date('Y-m-d 23:59::59',strtotime($data['end_time']));
$where['create_time'] = ['between', [$start_time,$end_time]];
}
if ($request['status'] !== '') {
$where['status'] =$request['status'];
}
$field = "sw.uuid,sn.name network_name,sn.contact_name,sn.contact_mobile as mobile,sn.province,sn.city,sw.create_time,sw.status,sw.money";
$result = ServiceWithdrawal::build()
->alias('sw')
->join('service_network sn','sw.service_uuid=sn.uuid')
//->join('engineer e','sn.uuid=e.service_uuid','left')
->field($field)
->where($where)
->order('create_time desc');
if ($request['is_export']==1) {
$arr = $result->select();
$arr = collection($arr)->toArray();
$result = [];
foreach ($arr as $first) {
unset($first['uuid']);
$result[] = array_values($first);
}
return $result;
}
return $result->paginate(['list_rows'=>$size, 'page'=>$page]);
}
public static function read($uuid){
return ServiceWithdrawal::build()->where(['uuid'=> $uuid])->find();
}
public static function submit($user,$request){
$password = ServiceNetwork::build()->where('uuid',$user['uuid'])->value('withdrawal_password');
if($password!=md5(md5($request['password']))){
ResponseDirect(18001);
}
//余额是否足够
$network_withdrawal_rate = Config::build()->where('key','network_withdrawal_rate')->value('value');
$network_withdrawal_rate = json_decode($network_withdrawal_rate,true);
$withdrawal_money = round((float)$request['money']*(1+(float)$network_withdrawal_rate['content']/100),2);
$remain = ServiceNetwork::build()->where(['uuid'=>$user['uuid']])->value('money');
if ($remain<$withdrawal_money) {
ResponseDirect(18002);
}
try{
Db::startTrans();
unset($request['password']);
$request['deduct_money'] = $withdrawal_money;
//提现表
ServiceWithdrawal::build()->insert($request);
//网点余额表
ServiceNetwork::build()->where(['uuid'=>$user['uuid']])->setDec('money',$withdrawal_money);
Db::commit();
return true;
}catch (Exception $e){
Db::rollback();
return false;
}
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: ChiaHsiang
* Date: 2018/8/3
* Time: 14:19
*/
namespace app\api\logic\web;
use app\api\model\Config;
use think\config as extra_config;
class ConfigLogic
{
public static function read($id) {
return Config::build()->where(['key' => $id])->field(['value'])->find();
}
public static function update($data) {
$bool = Config::build()
->where([
'key' => $data['key']
])->field([
'value'
])->find();
if (!empty($bool)) {
if($data['key'] =="advertise_img_src" || $data['key'] =="broker_template"){
$domain= extra_config::get('qiniu.BucketDomain');
$data['value']['content'] = $domain.'/'.$data['value']['content'];
}
return Config::build()->save($data, ['key' => $data['key']]);
}
return Config::build()
->save($data);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: ChiaHsiang
* Date: 2018/7/26
* Time: 10:44
*/
namespace app\api\logic\web;
use app\api\model\Jpush as JpushModel;
use app\api\model\Message;
use app\api\model\MessageUser;
use app\api\model\User;
use think\Db;
use think\Exception;
class MessageLogic
{
public static function index($user,$request,$page_index,$page_size)
{
if(!empty($request['uuid'])){
return MessageUser::build()->where('uuid','in',$request['uuid'])->update(['is_read'=>1]);
}
return MessageUser::build()
->where(['user_uuid'=>$user['uuid']])
->field('uuid,type,title,content,is_read,create_time')
->order('create_time desc')
->paginate(['page'=>$page_index,'list_rows'=>$page_size]);
}
public static function read($user,$id)
{
MessageUser::build()->where(['uuid'=>$id])->update(['is_read'=>1]);
return MessageUser::build()->field('uuid,type,title,content,create_time')->where(['uuid' => $id])->find();
}
public static function update($data)
{
$uuid = $data['uuid'];
unset($data['uuid']);
$data['update_time'] = timeToDate();
$data['type'] = 1;
return Message::build()->where(['uuid'=>$uuid])->update($data);
}
public static function save($data)
{
$user_uuid = User::build()->field('uuid')->where(['is_banned'=>0])->select();
$user_uuid = array_column($user_uuid,'uuid');
try{
Db::startTrans();
foreach ($user_uuid as $v){
$message['uuid'] = uuid();
$message['user_uuid'] = $v;
$message['title'] = $data['title'];
$message['content'] = $data['content'];
$message['message_uuid'] = $data['uuid'];
$result[] = $message;
}
//普通推送
MessageUser::build()->insertAll($result);
Message::build()->save($data);
}catch (\Exception $e){
Db::rollback();
return false;
}
return true;
}
public static function delete($id)
{
return Message::build()->where(['uuid' => $id])->update(['is_delete'=>1]);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: mac
* Date: 2019-09-23
* Time: 11:06
*/
namespace app\api\logic\web;
use app\api\model\Engineer;
use app\api\model\Engineering;
use app\api\model\EngineerMoneyDeal;
use app\api\model\MessageUser;
use app\api\model\Order;
use app\api\model\OrderExcel;
use app\api\model\Orderhistory;
use app\api\model\OrderMessage;
use app\api\model\OrderNode;
use app\api\model\OrderNodeDetail;
use app\api\model\OrderNodeMessage;
use app\api\model\OrderPay;
use app\api\model\ServiceNetwork;
use app\api\model\ServiceNetworkMoneyDeal;
use think\Db;
class OrderLogic
{
/**
* User: zhaoxin
* Date: 2019-09-23
* Time: 11:11
* description 工程项目
* @param $request
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function engineerings($request){
$list = Engineering::build()
->where(['type' => $request['type'],'is_delete' => '0'])
->field(['uuid','name'])
->order(['create_time' => 'desc'])
->select();
return ['list' => $list];
}
/**
* User: zhaoxin
* Date: 2019-09-23
* Time: 14:37
* description
* @param $request
* @param $user
* @return bool
* @throws \think\Exception
*/
public static function save($request,$user){
$request['uuid'] = uuid();
$request['user_uuid'] = $user['uuid'];
$request['create_time'] = timeToDate();
$request['code'] = '9356'.substr(date('Ymd'),2);
$order_excel = [];
foreach ($request['excel_list'] as $k => $v){
if (empty($v['excel_name']) || empty($v['excel_url'])){
continue;
}
$data = [
'uuid' => uuid(),
'order_uuid' => $request['uuid'],
'create_time' => $request['create_time'],
'name' => $v['excel_name'],
'url' => $v['excel_url']
];
$order_excel[] = $data;
}
unset($request['excel_list']);
$order_history = [
'uuid' => uuid(),
'order_uuid' => $request['uuid'],
'pay_status' => '0',
'status' => '0',
'is_check' => '0',
'name' => $request['contact_name'],
'mobile' => $request['contact_mobile'],
'create_time' => timeToDate(),
'update_time' => timeToDate()
];
$count = Engineering::build()
->where(['uuid' => $request['engineering_uuid'],'is_delete' => '0','type' => $request['type']])
->count();
if($count <=0){
ResponseDirect(14057);
}
Db::startTrans();
//订单excel材料
if(count($order_excel) >= 1){
$bool = OrderExcel::build()
->insertAll($order_excel);
if($bool == false){
ResponseDirect(14014);
}
}
$bool = Orderhistory::build()
->insert($order_history);
if($bool == false){
Db::rollback();
ResponseDirect(14015);
}
$count = Order::build()
->lock(true)
->whereTime('create_time','d')
->count();
$request['code'] = self::code($count,$request['code']);
$bool = Order::build()
->insert($request);
if($bool == false){
Db::rollback();
ResponseDirect(14013);
}
//消息通知
$bool = MessageUser::build()
->insert([
'uuid' => uuid(),
'user_uuid' => $user['uuid'],
'title' => '订单通知',
'content' => '您的订单已提交,请保持电话通畅,方便工作人员联系您!',
'other_uuid' => $request['uuid'],
'message_type' => '1',
'create_time' => timeToDate(),
]);
if($bool == false){
Db::rollback();
ResponseDirect(14059);
}
Db::commit();
return true;
}
private static function code($count,$code){
switch (strlen($count)){
case 1:
$code_e = '000'.$count;
break;
case 2:
$code_e = '00'.$count;
break;
case 3:
$code_e = '0'.$count;
break;
default:
$code_e = $count;
break;
}
return $code.$code_e;
}
public static function index($request,$user,$page_index,$page_size){
$where = ['user_uuid' => $user['uuid']];
if (!empty($request['keyword'])) {
$where['e.name'] = ['like',"%{$request['keyword']}%"];
}
if(!empty($request['engineering_type'])) {
$where['o.type'] = $request['engineering_type'];
}
switch ($request['order_status']){
case '1'://已下单
$where['o.pay_status'] = '0';
$where['o.status'] = '0';
break;
case '2'://已指派
$where['o.pay_status'] = '0';
$where['o.status'] = '1';
break;
case '3'://待确定
$where['o.pay_status'] = ['in',['1','2']];
$where['o.status'] = '1';
break;
case '4'://实施中
$where['o.pay_status'] = '2';
$where['o.status'] = '2';
break;
case '5'://已完成
$where['o.pay_status'] = '2';
$where['o.status'] = '3';
break;
case '6'://已取消
$where['o.pay_status'] = '3';
break;
default:
ResponseDirect(14017);
break;
}
if (!empty($request['start_time']) && !empty($request['end_time'])) {
$start_time = date('Y-m-d 00:00:00',strtotime($request['start_time']));
$end_time = date('Y-m-d 23:59:59',strtotime($request['end_time']));
$where['o.update_time'] = ['between time',[$start_time,$end_time]];
}
return Order::build()
->alias('o')
->join('engineering e','e.uuid = o.engineering_uuid')
->where($where)
->field([
'o.uuid','o.code','e.name','o.contact_name','o.contact_mobile','o.type','o.pay_status','o.status order_status',
'o.update_time','o.address'
])
->order(['o.update_time' => 'desc'])
->paginate(['list_rows' => $page_size, 'page' => $page_index]);
}
/**
* User: zhaoxin
* Date: 2019-09-23
* Time: 17:01
* description
* @param $id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function read($id){
$info['order_info'] = Order::build()
->alias('o')
->join('engineering e','e.uuid = o.engineering_uuid')
->where(['o.uuid' => $id])
->field([
'o.uuid','e.name','o.contact_name','o.contact_mobile','o.type','o.pay_status','o.status order_status',
'o.update_time','o.address','o.is_check','o.is_message','o.contract_img','o.contract_money','o.pay_type'
])
->find();
$info['excel_info'] = OrderExcel::build()
->where(['order_uuid' => $id])
->field(['uuid','name','url','create_time'])
->order(['create_time' => 'DESC'])
->select();
$info['order_history'] = Orderhistory::build()
->where(['order_uuid' => $id])
->field(['name','pay_status','status order_status','create_time','mobile'])
->order(['create_time' => 'DESC'])
->select();
$info['money_info'] = OrderPay::build()
->where(['order_uuid' => $id])
->field(['order_uuid','create_time','update_time'],true)
->order(['type' => 'ASC'])
->select();
if($info['order_info']['type'] == '2'){
$info['contract_info']['money'] = $info['order_info']['contract_money'];
$info['contract_info']['img'] = $info['order_info']['contract_img'];
}
unset($info['order_info']['contract_money']);
unset($info['order_info']['contract_img']);
return $info;
}
public static function update($request,$id){
$request['update_time'] = timeToDate();
return order::build()
->where(['uuid' => $id])
->update($request);
}
public static function cancel($uuid){
$status = Order::build()->where(['uuid' => $uuid])->value('pay_status');
if($status != '0'){
ResponseDirect(14020);
}
$bool = MessageUser::build()
->insert([
'uuid' => uuid(),
'user_uuid' => Order::build()->where(['uuid' => $uuid])->value('user_uuid'),
'title' => '订单通知',
'content' => '您的订单已取消!',
'other_uuid' => $uuid,
'message_type' => '1',
'create_time' => timeToDate(),
]);
if($bool == false){
// Db::rollback();
ResponseDirect(14059);
}
return Order::build()
->where(['uuid' => $uuid])
->update([
'pay_status' => '3',
'update_time' => timeToDate()
]);
}
public static function uploadExcel($request){
$order_excel = [];
foreach ($request['excel_list'] as $k => $v){
if (empty($v['excel_name']) || empty($v['excel_url'])){
continue;
}
$data = [
'uuid' => uuid(),
'order_uuid' => $request['uuid'],
'create_time' => timeToDate(),
'name' => $v['excel_name'],
'url' => $v['excel_url']
];
$order_excel[] = $data;
}
//订单excel材料
if(count($order_excel) >= 1){
$bool = OrderExcel::build()
->insertAll($order_excel);
if($bool == false){
ResponseDirect(14014);
}
}
return true;
}
public static function deleteExcel($request){
return OrderExcel::build()
->where(['uuid' => $request['excel_uuid']])
->delete();
}
public static function progresses($request){
$type = Order::build()->where(['uuid' => $request['order_uuid']])->value('type');
if($type == '1'){
$list = OrderNode::build()
->where(['order_uuid' => $request['order_uuid']])
->field(['name','time','uuid detail'])
->order(['time' => 'ASC'])
->select();
}else{
$list = OrderNodeDetail::build()
->where(['order_uuid' => $request['order_uuid']])
->field(['uuid','time','remark','img','uuid message'])
->order(['time' => 'ASC'])
->select();
}
return ['list' => $list];
}
public static function comfirmCheck($request){
$order_info = Order::build()
->where(['uuid' => $request['order_uuid']])
->field([
'engineer_uuid','contact_name','type','contact_mobile','is_check',
'is_confirm','service_uuid','money','is_assgin','pay_type','status',
'uuid'
])
->find();
if (empty($order_info)) {
ResponseDirect(14027);
}
if ($order_info['is_check'] != '1') {
ResponseDirect(14041);
}
if ($order_info['status'] == '4') {
ResponseDirect(14066);
}
Db::startTrans();
try{
$bool = Order::build()
->where(['uuid' => $request['order_uuid']])
->update([
'status' => ($order_info['pay_type'] == '1') ? '3' : '4',
'update_time' => timeToDate()
]);
if($bool == false){
ResponseDirect(14019);
}
$bool = Orderhistory::build()
->insert([
'uuid' => uuid(),
'order_uuid' => $request['order_uuid'],
'pay_status' => '2',
'status' => ($order_info['pay_type'] == '1') ? '3' : '4',
'is_check' => '1',
'name' => $order_info['contact_name'],
'mobile' => $order_info['contact_mobile'],
'create_time' => timeToDate()
]);
if ($bool == false) {
ResponseDirect(14015);
}
//尾款
if ($order_info['pay_type'] == '1') {
$bool = OrderPay::build()
->where(['order_uuid' => $request['order_uuid'],'type' => $request['pay_type']])
->update([
'update_time' => timeToDate(),
'pay_status' => '1',
'pay_money' => $request['money'],
'img' => $request['pay_img']
]);
if ($bool == false) {
ResponseDirect(14064);
}
}
//全款
if ($order_info['pay_type'] == '2') {
Order::settlement($order_info, $request);
}
Db::commit();
}catch (\Exception $e) {
DB::rollback();
ResponseDirect(14025);
}
return true;
}
public static function messagees($uuid){
return OrderMessage::build()
->alias('om')
->join('user u','u.uuid = om.user_uuid')
->where(['om.order_uuid' => $uuid])
->field(['om.type','om.content','om.create_time','u.name','u.avatar'])
->find();
}
public static function message($request, $user){
$order_info = Order::build()
->where(['uuid' => $request['order_uuid']])
->field(['engineer_uuid','contact_name','contact_mobile','is_check','is_message'])
->find();
if (empty($order_info)) {
ResponseDirect(14027);
}
if ($order_info['is_message'] == '1') {
ResponseDirect(14043);
}
DB::startTrans();
$bool = Order::build()
->where(['uuid' => $request['order_uuid']])
->update([
'is_message' => '1',
'update_time' => timeToDate()
]);
if ($bool == false) {
ResponseDirect(14019);
}
$bool = OrderMessage::build()
->insert([
'uuid' => uuid(),
'order_uuid' => $request['order_uuid'],
'user_uuid' => $user['uuid'],
'type' => $request['message_type'],
'content' => $request['message_content'],
'create_time' => timeToDate()
]);
if ($bool == false) {
Db::rollback();
ResponseDirect(14042);
}
if ($request['message_type'] == '1') {
$bool = Engineer::build()
->where(['uuid' => $order_info['engineer_uuid']])
->setInc('praise_number');
if ($bool == false) {
DB::rollback();
ResponseDirect(14048);
}
}
Db::commit();
return true;
}
public static function nodeMessage($request, $user){
$node_info = OrderNodeDetail::build()
->where(['uuid' => $request['node_uuid']])
->field(['is_message'])
->find();
if (empty($node_info)) {
ResponseDirect(14069);
}
if ($node_info['is_message'] == '1') {
ResponseDirect(14070);
}
DB::startTrans();
$bool = OrderNodeDetail::build()
->where(['uuid' => $request['node_uuid']])
->update([
'is_message' => '1',
'update_time' => timeToDate()
]);
if ($bool == false) {
ResponseDirect(14071);
}
$bool = OrderNodeMessage::build()
->insert([
'uuid' => uuid(),
'node_uuid' => $request['node_uuid'],
'user_uuid' => $user['uuid'],
'type' => $request['message_type'],
'content' => $request['message_content'],
'create_time' => timeToDate()
]);
if ($bool == false) {
Db::rollback();
ResponseDirect(14071);
}
Db::commit();
return true;
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Airon
* Date: 2017/7/11
* Time: 14:56
*/
namespace app\api\logic\web;
use app\api\model\UserSms as SmsModel;
class SendLogic
{
public static function SendSms($mobile, $sms_type)
{
//todo 为了测试方便 默认123456
// $code = '123456';
// $bool = SmsModel::build()->insert([
// 'uuid' => uuid(),
// 'mobile' => $mobile,
// 'sms_type' => $sms_type,
// 'sms_code' => $code,
// 'send_result' => 'ok',
// 'create_time' => timeToDate(time()),
// 'update_time' => timeToDate(time()),
// ]);
// return $bool;
return SmsModel::sendSms($mobile, randString(6), $sms_type);
}
public static function validateCode($requestData)
{
return SmsModel::validateCode(
$requestData['mobile'],
$requestData['code'],
$requestData['sms_type']
);
}
}
\ No newline at end of file
<?php
/**
*
* Created by PhpStorm.
* User: fenggaoyuan
* Email: 253869997@qq.com
* Date: 2018/7/26
* Time: 11:35
*/
namespace app\api\logic\web;
use app\api\model\Subaccount;
use app\api\model\Order;
use app\api\model\User;
use think\Db;
use think\Exception;
class SubaccountLogic
{
/**
* @author: star
* @time: 2019年9月
* 列表
*/
public static function index($user)
{
return User::build()
->alias('u')
->join('user_subaccount us','us.parent_uuid=u.uuid')
->field('us.uuid,us.position,us.name,us.mobile,us.create_time')
->where(['u.uuid'=>$user['uuid']])
->order('us.create_time desc')
->paginate(['page'=>1,'list_rows'=>3]);
}
/**
* @author: star
* @time: 2019年9月
* 详情
*/
public static function read($uuid)
{
$where['uuid'] = $uuid;
return Subaccount::build()->where($where)->find();
}
/**
* @author: star
* @time: 2019年9月
* 新增
*/
public static function save($request)
{
$number = Subaccount::build()->where(['parent_uuid'=>$request['parent_uuid']])->count();
if($number>3){
ResponseDirect(16296);//最多三个子账号
}
$request['uuid'] = uuid();
try{
Db::startTrans();
//添加子账号
Subaccount::build()->insert($request);
//写入用户表
$company_info = User::build()
->where(['uuid'=>$request['parent_uuid']])
->field('company_name,company_mobile,company_contact,business_licence,province,city,county,detail')
->find();
//企业子账号用户信息
$company_user['uuid'] = $request['uuid'];
$company_user['name'] = $request['name'];
$company_user['account'] = $request['mobile'];
$company_user['mobile'] = $request['mobile'];
$company_user['type'] = 2;
$company_user['account_grade'] = 2;
$company_user['password'] = md5(md5($request['password']));
$company_user['company_name'] = $company_info['company_name'];
$company_user['company_mobile'] = $company_info['company_mobile'];
$company_user['company_contact'] = $company_info['company_contact'];
if(!empty($company_info['business_licence'])){
$company_user['business_licence'] = json_encode($company_info['business_licence']);
}
$company_user['province'] = $company_info['province'];
$company_user['city'] = $company_info['city'];
$company_user['county'] = $company_info['county'];
$company_user['detail'] = $company_info['county'];
$company_user['create_time'] = timeToDate();
$company_user['update_time'] = timeToDate();
User::build()->insert($company_user);
Db::commit();
return true;
}catch(\Exception $e){
Db::rollback();
return false;
}
}
/**
* @author: star
* @time: 2019年9月
* 更新
*/
public static function update($id,$request)
{
try{
Db::startTrans();
Db::commit();
//编辑子账号表
Subaccount::build()->where(['uuid'=>$id])->update($request);
//用户表
$data['account'] = $request['mobile'];
$data['name'] = $request['name'];
//电话是否改动
$mobile = User::build()->where(['uuid'=>$id])->value('mobile');
if($mobile!=$request['mobile']){
$data['mobile'] = $request['mobile'];
}
$data['password'] = md5(md5($request['password']));
$data['update_time'] = timeToDate();
User::build()->where(['uuid'=>$id])->update($data);
return true;
}catch(\Exception $e){
Db::rollback();
return false;
}
}
/**
* @author: star
* @time: 2019年9月
* 更新
*/
public static function delete($id)
{
try{
Db::startTrans();
Db::commit();
Subaccount::build()->where(['uuid'=>$id])->delete();
User::build()->where(['uuid'=>$id])->delete();
return true;
}catch(\Exception $e){
Db::rollback();
return false;
}
}
/**
* @author: star
* @time: 2019年9月
* 订单列表
*/
public static function order_list($user,$page_index,$page_size)
{
return Order::build()
->alias('o')
->join('engineering e','e.uuid=o.engineering_uuid')
->join('user u','u.uuid=o.user_uuid')
->field('o.uuid,e.type,e.name,o.contact_name,o.contact_mobile,o.status')
->where(['o.user_uuid'=>$user['uuid'],'o.pay_status'=>2])
->order('o.create_time desc')
->paginate(['page'=>$page_index,'list_rows'=>$page_size]);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: ChiaHsiang
* Date: 2018/7/26
* Time: 10:44
*/
namespace app\api\logic\web;
use app\api\model\UserFeedback;
class UserFeedBackLogic
{
public static function save($data)
{
return UserFeedback::build()->save($data);
}
}
\ No newline at end of file
<?php
/**
*
* Created by PhpStorm.
* User: fenggaoyuan
* Email: 253869997@qq.com
* Date: 2018/7/26
* Time: 11:35
*/
namespace app\api\logic\web;
use app\api\logic\app\ConfigLogic;
use app\api\model\Config;
use app\api\model\SmsModel;
use app\api\model\MessageUser;
use app\api\model\Subaccount;
use app\api\model\User;
use app\api\model\UserOauth;
use app\api\model\UserToken;
use app\common\tools\wechatUtil;
use think\Db;
use think\Exception;
class UserLogic
{
public static function checkUser($mobile)
{
$bool = User::build()->where(['account' => $mobile])->find();
return empty($bool) ? false : true;
}
/**
* @author: star
* @time: 2019年9月
* description 检查邮箱是否绑定账号
*/
public static function checkEmail($email)
{
$bool = User::build()->where(['email' => $email])->find();
return empty($bool) ? false : true;
}
/**
* @author: star
* @time: 2019年9月
* description 退出登录
*/
public static function loginOut($uuid){
$bool = UserToken::build()->where(['user_uuid' => $uuid])->update([
'expiry_time' => timeToDate(time())
]);
if($bool){
return true;
}
return false;
}
public static function unbind($request){
$bool = User::build()
->where([
'uuid'=>$request['uuid']
])
->update([
'openid'=>null,'unionid'=>null,'update_time'=>timeToDate(),
'nickname'=>null,'avatar'=>null
]);
if($bool){
return true;
}
return false;
}
/**
* @author: star
* @time: 2019年9月
* description 绑定账户
*/
public static function bandWeChat($request){
$user = User::build()->where(['account'=>$request['mobile']])->find();
if($user['is_banned']==1){
ResponseDirect(12021);//账户被禁用
}
$bool = User::build()
->where([
'account'=>$request['mobile']
])
->update([
'openid'=>$request['openid'],'unionid'=>$request['unionid'],'update_time'=>timeToDate(),
'nickname'=>$request['nickname'],'avatar'=>$request['avatar']
]);
if($bool){
return true;
}
return false;
}
/**
* @author: Airon
* @time: 2019年5月
* description 获取微信用户信息
* @param $data
* @return array|bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function getWechatInfo($data)
{
$config = config('wechat');
$result = wechatUtil::getAccessToken($config['PublicAppID'], $config['PublicAppSecret'], $data['jscode']);
$result = json_decode($result, true);
if (!empty($result['errcode'])) {
(new self())->returnmsg(403, [], [], 'jsCode Error', "", $result['errmsg']);
}
$user_info = wechatUtil::getUserInfo($result['access_token'], $result['openid']);
if (empty($user_info)) {
(new self())->returnmsg(403, [], [], 'login Error', "", "获取失败");
}
$user_info = json_decode($user_info, true);
$user_info['nickname'] = $result['nickname'];
$user_info['avatar'] = $result['headimgurl'];
$user_info['openid'] = $result['openid'];
$user_info['unionid'] = empty($result['unionid']) ? "" : $result['unionid'];
return $user_info;
}
public static function save($data)
{
//根据ouath_uuid获取授权信息
$result = UserOauth::build()->where(['uuid'=>$data['oauth_uuid']])->find();
$data['openid'] = $result['pc_oauth_id'];
$data['unionid'] = $result['union_id'];
$data['avatar'] = $result['avatar'];
$data['nickname'] = $result['nickname'];
unset($data['oauth_uuid']);
return User::build()->insert($data);
}
public static function edit_email($data,$user)
{
return User::build()->where(['uuid'=>$user['uuid']])->update(['email'=>$data['email'],'update_time'=>timeToDate()]);
}
public static function edit_info($data)
{
//更新
$info = [];
if($data['type']==1){//普通用户
$info['name'] = $data['name'];
$info['mobile'] = $data['mobile'];
//$info['email'] = $data['email'];
$info['province'] = $data['province'];
$info['city'] = $data['city'];
$info['county'] = $data['county'];
$info['detail'] = $data['detail'];
$info['update_time'] = timeToDate();
}
if($data['type']==2){//企业用户
$info['company_name'] = $data['company_name'];
//$info['email'] = $data['email'];
$info['company_mobile'] = $data['company_mobile'];
$info['company_contact'] = $data['company_contact'];
// if(!empty($data['business_licence'])){
// $info['business_licence'] = json_encode($data['business_licence']);
// }
$info['province'] = $data['province'];
$info['city'] = $data['city'];
$info['county'] = $data['county'];
$info['detail'] = $data['detail'];
$info['update_time'] = timeToDate();
}
if($data['type']==3){//企业子账号用户
$info['name'] = $data['name'];
$info['mobile'] = $data['mobile'];
$info['position'] = $data['position'];
$info['update_time'] = timeToDate();
$result = Subaccount::build()->where(['uuid'=>$data['uuid']])->update($info);
if(!$result){
ResponseDirect(11006);
}
unset($info['position']);
$info['account'] = $data['mobile'];
}
return User::build()->where(['uuid'=>$data['uuid']])->update($info);
}
}
\ No newline at end of file
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace app\api\model; namespace app\api\model;
use think\Collection; use think\Collection;
use think\Db;
use think\Model; use think\Model;
class User extends Model class User extends Model
...@@ -20,56 +21,37 @@ class User extends Model ...@@ -20,56 +21,37 @@ class User extends Model
* @time: 2019年3月 * @time: 2019年3月
* description 验证码登录 * description 验证码登录
*/ */
public function login($requestData,$oauth_uuid = "") public function login($requestData)
{ {
if($requestData['login_type']==1){//账号密码登录 $user = self::build()->where(['oauth_id' => $requestData['openid']])->find();
$password = self::build()->where(['account' => $requestData['mobile']])
->field(['password'],false)->find();
$md5Password = md5(md5($requestData['password']));
if($password){
if($md5Password != $password['password']){
ResponseDirect(12022);
}
}else{
ResponseDirect(12013);
}
unset($password);
$user = self::build()->where(['account' => $requestData['mobile'],'password' => $md5Password]) Db::startTrans();
->field(['password'],true)->find(); if ($user) {
} if(!empty($requestData['openid']) && !empty($requestData['avatar']) && isset($requestData['unionid']) && isset($requestData['wechat_name'])){
if($requestData['login_type']==2){//验证码登录 self::build()->where(['oauth_id' => $requestData['openid']])
$user = self::build()->where(['account' => $requestData['mobile']])->field(['password'],true)->find(); ->update(['avatar'=>$requestData['avatar'],'unionid'=>$requestData['unionid'],'wechat_name'=>$requestData['wechat_name']]);
if(empty($user)){
ResponseDirect(12063);
}
}
if($requestData['login_type']==3){//微信登录
$user = self::build()->where(['openid' => $requestData['openid']])->field(['password'],true)->find();
if(empty($user)){
ResponseDirect(12061);
}
} }
if ($user['is_banned'] == '1') {
ResponseDirect(12021);
}
$token = UserToken::storeToken($user['uuid']); $token = UserToken::storeToken($user['uuid']);
}else{
$uuid = uuid();
$companys['info']['token'] = $token; $bool = self::build()
$companys['info']['user_info'] = self::build() ->insert([
->where(['uuid'=>$user['uuid']]) 'uuid' => $uuid,
->field(['password','is_banned'],true) 'oauth_id' => $requestData['openid'],
->find(); 'avatar' => $requestData['avatar'],
if($companys['info']['user_info']['type']==2 and $companys['info']['user_info']['account_grade']==1){ 'unionid' => $requestData['unionid'],
$companys['info']['user_info']['type']=2; 'wechat_name' => $requestData['wechat_name'],
} 'create_time' => timeToDate()
if($companys['info']['user_info']['type']==2 and $companys['info']['user_info']['account_grade']==2){ ]);
$companys['info']['user_info']['type']=3; $token = UserToken::storeToken($uuid);
$companys['info']['user_info']['position'] = \app\api\model\Subaccount::build()->where(['uuid'=>$companys['info']['user_info']['uuid']])->value('position'); $user = self::build()->where(['oauth_id' => $requestData['openid']])->find();
} }
return $companys; Db::commit();
$users['token'] = $token;
$users['user_info'] = $user;
return $users;
} }
......
...@@ -15,7 +15,7 @@ return [ ...@@ -15,7 +15,7 @@ return [
// 服务器地址 // 服务器地址
'hostname' => 'rm-wz9z40fs394wti63aio.mysql.rds.aliyuncs.com', 'hostname' => 'rm-wz9z40fs394wti63aio.mysql.rds.aliyuncs.com',
// 数据库名 // 数据库名
'database' => 'zf_union', 'database' => 'hh',
// 用户名 // 用户名
'username' => 'dankal_master',// 'username' => 'dankal_master',//
// 密码 // 密码
......
...@@ -30,277 +30,6 @@ return [ ...@@ -30,277 +30,6 @@ return [
'12001' => '用户未注册', '12001' => '用户未注册',
'12002' => '账号或密码错误', '12002' => '账号或密码错误',
'12003' => '登录失败', '12003' => '登录失败',
'12004' => 'TOKEN验证失败',
'12005' => '该用户已绑定手机',
'12006' => '手机号不一致',
'12007' => '该手机已被绑定',
'12008' => '未找到推荐用户',
'12009' => '注册失败',
'12010' => '账号密码错误',
'12011' => '编辑失败',
'12012' => '退出失败',
'12013' => '账号不存在',
'12014' => '未绑定应用',
'12015' => '解绑失败',
'12016' => '反馈失败',
'12017' => '添加失败',
'12018' => '删除失败',
'12019' => '地址最多添加20条',
'12020' => '该用户名已存在',
'12021' => '当前账号已被禁用',
'12022' => '密码输入错误',
'12023' => '服务数据查询失败',
'12061' => '当前微信还未绑定账户',
'12062' => '该手机号已注册',
'12063' => '该手机号未注册',
'12064' => '信息发送出现了一点小问题哟~',
'12065' => '服务器错误,更改密码失败',
'12066' => '邮件发送出了点问题哟~',
'12067' => '该邮箱还未绑定账号',
'12068' => '该邮箱已经绑定了账号',
'12069' => '微信解除绑定失败',
'12070' => 'form_id保存失败',
//单项配置
'16051' => '编辑失败',
'16052' => '内容获取失败',
//服务案列
'16081' => '案列列表获取失败',
'16082' => '案列详情获取失败',
'16083' => '新增案列失败',
'16084' => '编辑案列失败',
'16085' => '删除案列失败',
//合作伙伴
'16110' => '合作伙伴列表获取失败',
'16111' => '合作伙伴详情获取失败',
'16112' => '新增合作伙伴失败',
'16113' => '编辑合作伙伴失败',
'16114' => '删除合作伙伴失败',
//轮播图
'16130' => '轮播图列表获取失败',
'16131' => '轮播图详情获取失败',
'16132' => '新增轮播图失败',
'16133' => '编辑轮播图失败',
'16134' => '删除轮播图失败',
//服务优势
'16160' => '服务优势列表获取失败',
'16161' => '服务优势详情获取失败',
'16162' => '新增服务优势失败',
'16163' => '编辑服务优势失败',
'16164' => '删除服务优势失败',
//关于我们
'16180' => '关于我们列表获取失败',
'16181' => '关于我们详情获取失败',
'16182' => '新增关于我们失败',
'16183' => '编辑关于我们失败',
'16184' => '删除关于我们失败',
//帮助中心
'16200' => '帮助中心列表获取失败',
'16201' => '帮助中心详情获取失败',
'16202' => '新增帮助中心失败',
'16203' => '编辑帮助中心失败',
'16204' => '删除帮助中心失败',
//意见反馈
'16230' => '提交失败',
'16231' => '获取意见反馈列表失败',
'16232' => '获取意见反馈详情失败',
'16233' => '删除意见反馈失败',
//企业新闻
'16260' => '新闻列表获取失败',
'16261' => '新闻详情获取失败',
'16262' => '新增新闻失败',
'16263' => '编辑新闻失败',
'16264' => '删除新闻失败',
//编辑个人信息
'16265' => '编辑个人信息失败',
//模板表单
'16301' => '模板获取失败',
'16302' => '编辑模板失败',
//子账号
'16290' => '子账号列表获取失败',
'16291' => '子账号详情获取失败',
'16292' => '新增子账号失败',
'16293' => '编辑子账号失败',
'16294' => '删除子账号失败',
'16295' => '订单列表获取失败',
'16296' => '主账号最多添加3个子账号',
'16297' => '抱歉,您当前账户不是企业主账号',
//消息通知
'16310' => '消息列表获取失败',
'16311' => '消息详情获取失败',
'16312' => '新增消息失败',
'16313' => '编辑消息失败',
'16314' => '删除消息失败',
'16315' => '标记已读失败',
//加入智服联盟
'16361' => '资料提交失败',
//财务部分
'16371' => '订单列表获取失败',
'16372' => '订单详情获取失败',
'16373' => '订单数据获取失败',
//app提现
'16400' => '密码设置失败',
'16401' => '您还没有添加银行卡~',
'16402' => '添加银行卡失败',
'16403' => '提现失败',
'16404' => '银行卡已存在',
'12041' => '用户列表获取失败',
'12042' => '企业用户列表获取失败',
'12043' => '用户详情获取失败',
'12044' => '企业用户详情获取失败',
'12045' => '新增个人用户失败',
'12046' => '新增企业用户失败',
'12047' => '用户禁用失败',
'12048' => '用户解禁失败',
//提现部分
'18000' => '提现申请提交失败',
'18001' => '密码错误',
'18002' => '余额不足',
'18003' => '提现列表获取失败',
'18004' => '提现详情获取失败',
'18005' => '状态修改失败',
'18006' => '提现申请不存在',
'18007' => '已审核,请勿重复操作',
'18008' => '数据格式错误',
'13000' => '已有工程师使用该手机号',
'13001' => '工程师注册失败',
'13002' => '小程序授权失败',
'13003' => '小程序授权数据存储失败',
'13004' => '小程序绑定手机号失败',
'13005' => '工程师关联小程序失败',
'13006' => '无授权信息,请重新授权',
'13007' => '该手机号不是授权绑定的手机号',
'13008' => '该手机号未进行注册',
'13009' => '重置密码失败',
'13010' => '个人中心查询失败',
'13011' => '工程师列表查看失败',
'13012' => '工程师详情查看失败',
'13013' => '工程师删除失败',
'13014' => '找不到该工程师',
'13015' => '该工程师未认证',
'13016' => '该工程师属于服务网点,不能进行指派',
'13017' => '该工程师认证操作失败',
'13018' => '该工程师认证编辑失败',
'13019' => '工程师反馈失败',
'13020' => '工程师查看员工计划失败',
'13021' => '工程师导入失败',
'14000' => '查询工程注册失败',
'14001' => '新增工程项目失败',
'14002' => '编辑工程项目失败',
'14003' => '查询工程项目失败',
'14004' => '删除工程项目失败',
'14005' => '新增工程等级失败',
'14006' => '编辑工程等级失败',
'14007' => '删除工程等级失败',
'14008' => '查询工程等级失败',
'14009' => '查询工程目标失败',
'14010' => '新增工程目标失败',
'14011' => '编辑工程目标失败',
'14012' => '删除工程目标失败',
'14013' => '工程订单提交失败',
'14014' => '工程订单清单添加失败',
'14015' => '工程订单历史添加失败',
'14016' => '工程订单查询失败',
'14017' => '工程订单状态出错',
'14018' => '工程订单详情查看失败',
'14019' => '工程订单编辑失败',
'14020' => '该工程订单不能取消',
'14021' => '工程订单取消失败',
'14022' => '工程订单表单上传失败',
'14023' => '工程订单指派失败',
'14024' => '工程订单暂无权限查看',
'14025' => '工程订单确认指派失败',
'14026' => '该服务网点未指派工程师,不能进行下一步',
'14027' => '工程订单不存在',
'14028' => '该工程订单未上传材料清单,不能进行下一步',
'14029' => '工程订单上传支付凭证失败',
'14030' => '工程订单未支付',
'14031' => '工程订单进度查看失败',
'14032' => '工程订单进度节点添加失败',
'14033' => '工程订单进度节点重复',
'14034' => '工程订单进度节点时间必须在项目区间内',
'14035' => '请先填写工程订单的开始与结束时间',
'14036' => '工程订单的开始时间不能大于结束时间',
'14037' => '工程订单的开始时间不能小于结束时间',
'14038' => '工程订单节点不存在',
'14039' => '工程订单申请验收失败',
'14040' => '工程订单确认验收失败',
'14041' => '该工程订单未申请验收',
'14042' => '该工程订单评论失败',
'14043' => '该工程订单只能评论一次',
'14044' => '服务网点收入记录添加失败',
'14045' => '服务网点金额添加失败',
'14046' => '订单数据查看失败',
'14047' => '工程师接单数量添加失败',
'14048' => '工程师好评数量添加失败',
'14049' => '开始和结束时间不能为空',
'14050' => '只能维保订单才能上传合同图片',
'14051' => '输入金额失败',
'14052' => '只能维保订单才能设置合同金额',
'14053' => '维保订单只能由工程师点击下一步',
'14054' => '工程订单只能由后台点击下一步',
'14055' => '维保订单点击下一步出错',
'14056' => '请先上传合同再进行维保',
'14057' => '工程项目不存在,请重新选择',
'14058' => '订单状态已更改',
'14059' => '订单消息添加失败',
'14060' => '比率不能大于100',
'14061' => '订单工程师添加失败',
'14062' => '请至少添加一个协助工程师',
'14063' => '订单支付信息添加失败',
'14064' => '订单支付失败',
'14065' => '只能负责的工程师才能申请验收',
'14066' => '订单已验收完成',
'14067' => '订单支付类型为全款,不能点击完成',
'14068' => '订单确认完成失败',
'14069' => '订单节点不存在',
'14070' => '该工程订单节点只能评论一次',
'14071' => '该工程订单节点评论失败',
'15000' => '服务网点列表查询失败',
'15001' => '服务网点新增失败',
'15002' => '已存在相同的服务网点联系方式',
'15003' => '服务网点编辑失败',
'15004' => '服务网点删除失败',
'15005' => '服务网点登陆账号新增失败',
'15006' => '服务网点分配权限失败',
'15007' => '服务网点账号密码错误',
'15008' => '服务网点信息查看失败',
'15009' => '服务网点审核失败',
'15010' => '服务网点信息已在审核,不能进行编辑',
'15011' => '服务网点信息不存在',
'15012' => '服务网点信息获取失败',
'17000' => '目标列表查询失败',
'17001' => '目标新增失败',
'17002' => '目标编辑失败',
'17003' => '目标删除失败',
'17004' => '目标查询失败',
'50002' => '账号无权限'
]; ];
...@@ -12,208 +12,9 @@ ...@@ -12,208 +12,9 @@
use think\Route; use think\Route;
use think\Request; use think\Request;
Route::resource(':version/app/qiniu', 'api/:version.app.qiniu'); Route::post(':version/app/User/login', 'api/:version.app.User/login');//登录
//Engineer模块
Route::post(':version/app/engineer/login', 'api/:version.app.Engineer/login');//登录
Route::post(':version/app/engineer/oauth', 'api/:version.app.Engineer/oauth');//授权
Route::put(':version/app/engineer/change-image', 'api/:version.app.Engineer/changeImage');//授权
Route::post(':version/app/engineer/advise', 'api/:version.app.Engineer/advise');//授权
Route::get(':version/app/engineer/look-info', 'api/:version.app.Engineer/lookInfo');//授权
Route::get(':version/app/engineer/look-info-detail', 'api/:version.app.Engineer/lookInfoDetail');//授权
Route::get(':version/app/engineer/questiones', 'api/:version.app.Engineer/questiones');//授权
Route::get(':version/app/engineer/plans', 'api/:version.app.Engineer/plans');//授权
Route::get(':version/app/engineer/plan-info', 'api/:version.app.Engineer/planInfo');//授权
Route::get(':version/app/engineer/service-data', 'api/:version.app.Engineer/serviceData');//授权
Route::post(':version/app/engineer/save-form-id', 'api/:version.app.Engineer/saveFormId');//授权
Route::post(':version/app/engineer/band-mobile', 'api/:version.app.Engineer/bandMobile');//绑定手机号
Route::post(':version/app/engineer/check-code', 'api/:version.app.Engineer/checkCode');//验证
Route::post(':version/app/engineer/reset-password', 'api/:version.app.Engineer/resetPassword');//重置密码
Route::resource(':version/app/engineer', 'api/:version.app.Engineer');
//提现
Route::post(':version/app/Withdrawal/submit', 'api/:version.app.Withdrawal/submit');//提现
Route::post(':version/app/Withdrawal/add-bank', 'api/:version.app.Withdrawal/add_bank');//添加银行卡
Route::get(':version/app/Withdrawal/bank-list', 'api/:version.app.Withdrawal/bank_list');//银行卡列表
Route::post(':version/app/Withdrawal/set-password', 'api/:version.app.Withdrawal/set_password');//设置提现密码
Route::post(':version/app/Withdrawal/index', 'api/:version.app.Withdrawal/index');//列表;
//Route::resource(':version/app/Withdrawal', 'api/:version.app.Withdrawal');
//Engineering模块
Route::get(':version/app/engineering/registers', 'api/:version.app.Engineering/registers');//工程注册
Route::resource(':version/app/engineering', 'api/:version.app.Engineering');
Route::put(':version/app/order/upload-excel', 'api/:version.app.order/uploadExcel');
Route::get(':version/app/order/nodes', 'api/:version.app.order/nodes');
Route::get(':version/app/order/node-details', 'api/:version.app.order/nodeDetails');
Route::post(':version/app/order/add-node', 'api/:version.app.order/addNode');
Route::post(':version/app/order/add-node-detail', 'api/:version.app.order/addNodeDetail');
Route::put(':version/app/order/apply-check', 'api/:version.app.order/applyCheck');
Route::put(':version/app/order/upload-contract-img', 'api/:version.app.order/uploadContractImg');
Route::put(':version/app/order/set-money', 'api/:version.app.order/setMoney');
Route::put(':version/app/order/next', 'api/:version.app.order/next');
Route::get(':version/app/order/datas', 'api/:version.app.order/datas');
Route::resource(':version/app/order', 'api/:version.app.order');
//首页
Route::get(':version/app/Index/message', 'api/:version.app.Index/message');//公告
Route::get(':version/app/Index/message-detail', 'api/:version.app.Index/message_detail');//公告详情
Route::get(':version/app/Index/banner', 'api/:version.app.Index/banner');//轮播图
Route::get(':version/app/Index/news', 'api/:version.app.Index/news');//企业新闻
Route::get(':version/app/Index/news-detail', 'api/:version.app.Index/news_detail');//企业新闻详情
//Send
Route::post(':version/app/send/code', 'api/:version.app.Send/code');//发送验证码
Route::resource(':version/app/send', 'api/:version.app.Send');
//network
//提现
Route::post(':version/network/Withdrawal/submit', 'api/:version.network.Withdrawal/submit');
Route::resource(':version/network/Withdrawal', 'api/:version.network.Withdrawal');
Route::get(':version/network/engineering/registers', 'api/:version.app.Engineering/registers');//工程注册
Route::resource(':version/network/Menus', 'api/:version.network.Menus');
Route::resource(':version/network/finance', 'api/:version.network.Finance');
Route::resource(':version/network/Info', 'api/:version.network.Info');
Route::put(':version/network/order/appoint', 'api/:version.network.Order/appoint');//指派
Route::put(':version/network/order/cancel', 'api/:version.network.Order/cancel');//指派
Route::put(':version/network/order/confirm-appoint', 'api/:version.network.Order/confirmAppoint');//指派
Route::put(':version/network/order/update-certificate', 'api/:version.network.Order/updateCertificate');//指派
Route::put(':version/network/order/confirm-pay', 'api/:version.network.Order/confirmPay');//指派
Route::get(':version/network/order/node-details', 'api/:version.network.Order/nodeDetails');//指派
Route::resource(':version/network/order', 'api/:version.network.Order');
Route::put(':version/network/engineer/authentication', 'api/:version.network.engineer/authentication');
Route::post(':version/network/engineer/import', 'api/:version.network.engineer/import');
Route::post(':version/network/engineer/down-template', 'api/:version.network.engineer/downTemplate');
Route::resource(':version/network/engineer', 'api/:version.network.engineer');
Route::post(':version/network/admin/login', 'api/:version.network.Admin/login');//服务网点登陆
Route::resource(':version/network/admin', 'api/:version.network.Admin');
Route::get(':version/network/target/lists', 'api/:version.network.Target/lists');
Route::get(':version/network/target/achievements', 'api/:version.network.Target/achievements');
Route::resource(':version/network/target', 'api/:version.network.Target');
//总后台
//财务部分
Route::get(':version/cms/Finance/order-list', 'api/:version.cms.Finance/order_list');//订单列表
Route::get(':version/cms/Finance/chart', 'api/:version.cms.Finance/chart');//图表
Route::resource(':version/cms/Withdrawal', 'api/:version.cms.Withdrawal');//提现
Route::resource(':version/cms/EngineerWithdrawal', 'api/:version.cms.EngineerWithdrawal');//工程师提现
Route::resource(':version/cms/finance', 'api/:version.cms.Finance');//提现
Route::resource(':version/cms/engineering-registers', 'api/:version.cms.EngineeringRegisters');//提现
Route::resource(':version/cms/excel', 'api/:version.cms.excel');//模板部分
Route::resource(':version/cms/Message', 'api/:version.cms.Message');//消息通知
Route::resource(':version/cms/News', 'api/:version.cms.News');//新闻
Route::resource(':version/cms/UserFeedBack', 'api/:version.cms.UserFeedBack');//意见反馈
Route::resource(':version/cms/HelpCenterType', 'api/:version.cms.HelpCenterType');//帮助中心类型
Route::resource(':version/cms/HelpCenter', 'api/:version.cms.HelpCenter');//帮助中心
Route::resource(':version/cms/About', 'api/:version.cms.About');//关于我们
Route::resource(':version/cms/Example', 'api/:version.cms.Example');//案列
Route::resource(':version/cms/Cooperator', 'api/:version.cms.Cooperator');//合作伙伴
Route::get(':version/cms/User/lists', 'api/:version.cms.User/lists');//用户管理
Route::resource(':version/cms/User', 'api/:version.cms.User');//用户管理
Route::get(':version/cms/engineering/registers', 'api/:version.app.Engineering/registers');//工程注册
Route::resource(':version/cms/engineering', 'api/:version.cms.Engineering');//用户管理
Route::put(':version/cms/engineer/authentication', 'api/:version.cms.Engineer/authentication');//认证
Route::post(':version/cms/engineer/import', 'api/:version.cms.Engineer/import');//认证
Route::post(':version/cms/engineer/down-template', 'api/:version.cms.Engineer/downTemplate');//认证
Route::get(':version/cms/engineer/info', 'api/:version.cms.engineer/info');
Route::get(':version/cms/engineer/lists', 'api/:version.cms.engineer/lists');
Route::put(':version/cms/engineer/handle', 'api/:version.cms.engineer/handle');
Route::resource(':version/cms/engineer', 'api/:version.cms.Engineer');//工程师管理
Route::put(':version/cms/order/appoint', 'api/:version.cms.order/appoint');//订单指派
Route::post(':version/cms/order/engineer-list', 'api/:version.cms.order/EngineerList');//订单指派
Route::put(':version/cms/order/cancel', 'api/:version.cms.order/cancel');//订单指派
Route::put(':version/cms/order/confirm-appoint', 'api/:version.cms.order/confirmAppoint');//订单指派确认
Route::put(':version/cms/order/update-certificate', 'api/:version.cms.order/updateCertificate');//订单指派确认
Route::put(':version/cms/order/confirm-pay', 'api/:version.cms.order/confirmPay');//订单支付确认
Route::post(':version/cms/order/confirm-check', 'api/:version.cms.order/confirmCheck');//订单验收确认
Route::get(':version/cms/order/node-details', 'api/:version.cms.Order/nodeDetails');//指派
Route::resource(':version/cms/order', 'api/:version.cms.order');//订单
Route::put(':version/cms/network/handle', 'api/:version.cms.Network/handle');//服务网点审核
Route::get(':version/cms/network/info', 'api/:version.cms.Network/info');//服务网点审核
Route::get(':version/cms/network/lists', 'api/:version.cms.Network/lists');//服务网点审核
Route::get(':version/cms/network/checks', 'api/:version.cms.Network/checks');//服务网点审核列表
Route::resource(':version/cms/network', 'api/:version.cms.Network');//工程师管理
Route::get(':version/cms/engineering-target/lists', 'api/:version.cms.EngineeringTarget/lists');//工程师等级管理
Route::resource(':version/cms/engineering-target', 'api/:version.cms.EngineeringTarget');//工程师等级管理
Route::resource(':version/cms/engineering-grade', 'api/:version.cms.EngineeringGrade');//工程师等级管理
Route::get(':version/cms/target/achievements', 'api/:version.cms.target/achievements');//工程师等级管理
Route::resource(':version/cms/target', 'api/:version.cms.Target');//工程师等级管理
Route::resource(':version/cms/Banner', 'api/:version.cms.Banner');//轮播图
Route::resource(':version/cms/Advantage', 'api/:version.cms.Advantage');//服务优势
Route::post(':version/cms/Config/excel-edit', 'api/:version.cms.Config/excel_edit');//编辑模板
Route::post(':version/cms/Config/excel', 'api/:version.cms.Config/excel');//表单
Route::get(':version/cms/Config/excel', 'api/:version.cms.Config/excel');//表单
Route::resource(':version/cms/Config', 'api/:version.cms.Config');//配置
//web端
Route::post(':version/web/Message/index', 'api/:version.web.Message/index');//消息通知列表
Route::resource(':version/web/Message', 'api/:version.web.Message');//消息通知
Route::get(':version/web/Subaccount/order-list', 'api/:version.web.Subaccount/order_list');//订单列表
Route::resource(':version/web/Subaccount', 'api/:version.web.Subaccount');//子账号
Route::resource(':version/web/UserFeedBack', 'api/:version.web.UserFeedBack');//意见反馈
Route::get(':version/web/Index/map', 'api/:version.web.Index/map');//地图
Route::get(':version/web/Index/banner', 'api/:version.web.Index/banner');//轮播图
Route::get(':version/web/Index/advantage', 'api/:version.web.Index/advantage');//服务优势
Route::get(':version/web/Index/type-lists', 'api/:version.web.Index/type_lists');//公告
Route::get(':version/web/Index/news', 'api/:version.web.Index/news');//企业新闻
Route::get(':version/web/Index/news-detail', 'api/:version.web.Index/news_detail');//企业新闻详情
Route::get(':version/web/Index/about', 'api/:version.web.Index/about');//关于我们
Route::get(':version/web/Index/about-detail', 'api/:version.web.Index/about_detail');//关于我们详情
Route::get(':version/web/Index/help-detail', 'api/:version.web.Index/help_detail');//帮助中心详情
Route::get(':version/web/Index/help', 'api/:version.web.Index/help');//帮助中心
Route::get(':version/web/Index/project', 'api/:version.web.Index/project');//服务项目
Route::get(':version/web/Index/cooperator', 'api/:version.web.Index/cooperator');//合作伙伴
Route::get(':version/web/Index/example', 'api/:version.web.Index/example');//服务案列
Route::get(':version/web/Index/example-detail', 'api/:version.web.Index/example_detail');//服务案列详情
Route::post(':version/web/User/edit-email', 'api/:version.web.User/edit_email');//修改邮箱
Route::post(':version/web/User/register', 'api/:version.web.User/register');//用户注册
Route::post(':version/web/User/validate-email', 'api/:version.web.User/validate_email');//验证邮箱验证码
Route::get(':version/web/User/send-mail', 'api/:version.web.User/send_mail');//邮箱验证码
Route::post(':version/web/User/edit-info', 'api/:version.web.User/edit_info');//编辑用户信息
Route::get(':version/web/User/baseInfo', 'api/:version.web.User/baseInfo');//用户信息
Route::get(':version/web/User/unbind', 'api/:version.web.User/unbind');//微信解除绑定账户
Route::post(':version/web/User/bandWeChat', 'api/:version.web.User/bandWeChat');//微信绑定账户
Route::post(':version/web/User/getBackPassword', 'api/:version.web.User/getBackPassword');//忘记密码
Route::post(':version/web/User/loginOut', 'api/:version.web.User/loginOut');//注销
Route::post(':version/web/User/login', 'api/:version.web.User/login');//登录
Route::post(':version/web/User/getWechatInfo', 'api/:version.web.User/getWechatInfo');//获取微信用户信息
Route::post(':version/web/User/wechatWebLoginUrl', 'api/:version.web.User/wechatWebLoginUrl');//微信链接
Route::resource(':version/web/User', 'api/:version.web.User');//用户注册登录部分
Route::get(':version/web/order/engineerings', 'api/:version.web.order/engineerings');//工程列表
Route::get(':version/web/order/progresses', 'api/:version.web.order/progresses');//工程列表
Route::get(':version/web/order/messagees', 'api/:version.web.order/messagees');//工程评价信息
Route::post(':version/web/order/message', 'api/:version.web.order/message');//工程评价信息
Route::post(':version/web/order/node-message', 'api/:version.web.order/nodeMessage');//工程评价信息
Route::put(':version/web/order/confirm-check', 'api/:version.web.order/confirmCheck');//确认验收
Route::put(':version/web/order/cancel', 'api/:version.web.order/cancel');//取消订单
Route::put(':version/web/order/update-certificate', 'api/:version.web.order/updateCertificate');//上传支付凭证
Route::post(':version/web/order/upload-excel', 'api/:version.web.order/uploadExcel');
Route::delete(':version/web/order/delete-excel', 'api/:version.web.order/deleteExcel');
Route::resource(':version/web/order', 'api/:version.web.order');//用户注册登录部分
Route::post(':version/web/Send/validateCode', 'api/:version.web.Send/validateCode');//验证验证码
Route::resource(':version/web/Send', 'api/:version.web.Send');//发送验证码
//权限管理部分 //权限管理部分
Route::post(':version/cms/Admins/login', 'api/:version.cms.Admins/login');//登录 Route::post(':version/cms/Admins/login', 'api/:version.cms.Admins/login');//登录
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment