Compare commits
24 Commits
424140eac5
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 90b2fde000 | |||
| da8125ca0e | |||
| 582212d295 | |||
| 6708ac5d47 | |||
| 8dc361b564 | |||
| 6062156d73 | |||
| dd2b423e7d | |||
| bd8566b5c6 | |||
| c1c61a8edc | |||
| 1d1f98027c | |||
| 03cdb34db4 | |||
| e1ceed176c | |||
| 151bde9550 | |||
| 7499fa7d01 | |||
| be368ad106 | |||
| c64939c7af | |||
| 90b02e4a08 | |||
| ed191269b1 | |||
| d4ca654560 | |||
| 849c2d5956 | |||
| 8b7bb72252 | |||
| 583f24676a | |||
| 88b326b1b8 | |||
| 38b429ec3d |
108
app/adminapi/controller/DeviceController.php
Normal file
108
app/adminapi/controller/DeviceController.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\DeviceLists;
|
||||
use app\adminapi\logic\DeviceLogic;
|
||||
use app\adminapi\validate\DeviceValidate;
|
||||
|
||||
|
||||
/**
|
||||
* Device控制器
|
||||
* Class DeviceController
|
||||
* @package app\adminapi\controller
|
||||
*/
|
||||
class DeviceController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2025/06/08 16:46
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new DeviceLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2025/06/08 16:46
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new DeviceValidate())->post()->goCheck('add');
|
||||
$result = DeviceLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(DeviceLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2025/06/08 16:46
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new DeviceValidate())->post()->goCheck('edit');
|
||||
$result = DeviceLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(DeviceLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2025/06/08 16:46
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new DeviceValidate())->post()->goCheck('delete');
|
||||
DeviceLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2025/06/08 16:46
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new DeviceValidate())->goCheck('detail');
|
||||
$result = DeviceLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
77
app/adminapi/lists/DeviceLists.php
Normal file
77
app/adminapi/lists/DeviceLists.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\Device;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Device列表
|
||||
* Class DeviceLists
|
||||
* @package app\adminapi\lists
|
||||
*/
|
||||
class DeviceLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2025/06/08 16:46
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['name', 'model', 'state', 'dtime'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2025/06/08 16:46
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return Device::where($this->searchWhere)
|
||||
->field(['id', 'name', 'model', 'state', 'dtime'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2025/06/08 16:46
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return Device::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
||||
112
app/adminapi/logic/DeviceLogic.php
Normal file
112
app/adminapi/logic/DeviceLogic.php
Normal file
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic;
|
||||
|
||||
|
||||
use app\common\model\Device;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* Device逻辑
|
||||
* Class DeviceLogic
|
||||
* @package app\adminapi\logic
|
||||
*/
|
||||
class DeviceLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2025/06/08 16:46
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
Device::create([
|
||||
'name' => $params['name'],
|
||||
'model' => $params['model'],
|
||||
'state' => $params['state'],
|
||||
'dtime' => date("Y-m-d H:i:s")
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2025/06/08 16:46
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
Device::where('id', $params['id'])->update([
|
||||
'name' => $params['name'],
|
||||
'model' => $params['model'],
|
||||
'state' => $params['state'],
|
||||
'dtime' => date("Y-m-d H:i:s")
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2025/06/08 16:46
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return Device::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2025/06/08 16:46
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
return Device::findOrEmpty($params['id'])->toArray();
|
||||
}
|
||||
}
|
||||
94
app/adminapi/validate/DeviceValidate.php
Normal file
94
app/adminapi/validate/DeviceValidate.php
Normal file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* Device验证器
|
||||
* Class DeviceValidate
|
||||
* @package app\adminapi\validate
|
||||
*/
|
||||
class DeviceValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return DeviceValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/06/08 16:46
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return DeviceValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/06/08 16:46
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return DeviceValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/06/08 16:46
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return DeviceValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/06/08 16:46
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
@ -66,12 +66,12 @@ class AccountController extends BaseApiController
|
||||
public function login()
|
||||
{
|
||||
$post = $this->request->post();
|
||||
$check = $this->validate($post, 'app\api\validate\Login.password');
|
||||
if (true !== $check) {
|
||||
$this->_error($check);
|
||||
}
|
||||
// $check = $this->validate($post, 'app\api\validate\Login.password');
|
||||
// if (true !== $check) {
|
||||
// $this->_error($check);
|
||||
// }
|
||||
$data = LoginLogic::login($post);
|
||||
$this->_success('登录成功', $data);
|
||||
return $this->success('登录成功', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -38,10 +38,10 @@ class CartController extends BaseApiController
|
||||
public function add()
|
||||
{
|
||||
$post = $this->request->post();
|
||||
$check = $this->validate($post, 'app\api\validate\CartValidate.add');
|
||||
if (true !== $check) {
|
||||
return $this->fail($check);
|
||||
}
|
||||
// $check = $this->validate($post, 'app\api\validate\CartValidate.add');
|
||||
// if (true !== $check) {
|
||||
// return $this->fail($check);
|
||||
// }
|
||||
$res = CartLogic::add($post['item_id'], $post['goods_num'], $this->userId);
|
||||
if ($res === true) {
|
||||
return $this->success('加入成功');
|
||||
@ -68,10 +68,10 @@ class CartController extends BaseApiController
|
||||
public function del()
|
||||
{
|
||||
$post = $this->request->post();
|
||||
$check = $this->validate($post, 'app\api\validate\Cart.del');
|
||||
if (true !== $check) {
|
||||
return $this->fail($check);
|
||||
}
|
||||
// $check = $this->validate($post, 'app\api\validate\Cart.del');
|
||||
// if (true !== $check) {
|
||||
// return $this->fail($check);
|
||||
// }
|
||||
if (CartLogic::del($post['cart_id'], $this->userId)) {
|
||||
return $this->success('删除成功');
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ class LoginController extends BaseApiController
|
||||
{
|
||||
$params = (new RegisterValidate())->post()->goCheck('register');
|
||||
$result = LoginLogic::register($params);
|
||||
if (true === $result) {
|
||||
if ($result) {
|
||||
return $this->success('注册成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(LoginLogic::getError());
|
||||
|
||||
@ -49,10 +49,10 @@ class OrderController extends BaseApiController
|
||||
$post = $this->request->post();
|
||||
$post['user_id'] = $this->userId;
|
||||
$post['client'] = $this->client;
|
||||
$check = $this->validate($post, 'app\api\validate\OrderValidate.buy');
|
||||
if (true !== $check) {
|
||||
return $this->fail($check);
|
||||
}
|
||||
// $check = $this->validate($post, 'app\api\validate\OrderValidate.buy');
|
||||
// if (true !== $check) {
|
||||
// return $this->fail($check);
|
||||
// }
|
||||
|
||||
$action = $post['action'];
|
||||
$info = OrderLogic::info($post, $this->userId);
|
||||
|
||||
@ -203,6 +203,7 @@ class PaymentController extends BaseApiController
|
||||
if(!isset($params['from']) || !isset($params['order_id'])) {
|
||||
return $this->fail('参数缺失');
|
||||
}
|
||||
$order = array();
|
||||
if($params['from'] == 'order') {
|
||||
$order = Db::name('order')->where('id', $params['order_id'])->find();
|
||||
}else if($params['from'] == 'recharge') {
|
||||
|
||||
@ -18,7 +18,7 @@ use app\api\logic\UserLogic;
|
||||
use app\api\validate\PasswordValidate;
|
||||
use app\api\validate\SetUserInfoValidate;
|
||||
use app\api\validate\UserValidate;
|
||||
|
||||
use weixin\Getopenid;
|
||||
/**
|
||||
* 用户控制器
|
||||
* Class UserController
|
||||
@ -26,7 +26,7 @@ use app\api\validate\UserValidate;
|
||||
*/
|
||||
class UserController extends BaseApiController
|
||||
{
|
||||
public array $notNeedLogin = ['resetPassword'];
|
||||
public array $notNeedLogin = ['resetPassword','getPhone'];
|
||||
|
||||
|
||||
/**
|
||||
@ -56,7 +56,13 @@ class UserController extends BaseApiController
|
||||
$result = UserLogic::info($this->userId);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
//获取手机号码
|
||||
public function getPhone(){
|
||||
$param = $this->request->param();
|
||||
$open=new Getopenid();
|
||||
$info=$open->getph($param['code']);
|
||||
return $this->success('', $info);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 重置密码
|
||||
|
||||
@ -33,7 +33,7 @@ class CartLogic
|
||||
$goods = Db::name('goods')->alias('g')
|
||||
->field('i.goods_id')
|
||||
->join('goods_item i', 'i.goods_id = g.id')
|
||||
->where('i.id', $item_id)
|
||||
->where('i.id|i.goods_id', $item_id)
|
||||
->find();
|
||||
|
||||
$time = time();
|
||||
@ -50,6 +50,17 @@ class CartLogic
|
||||
}
|
||||
|
||||
if ($info) {
|
||||
$goods_cart = Cart::where("goods_id",$goods['goods_id'])
|
||||
->where("user_id",$user_id)
|
||||
->select();
|
||||
$count = 0;
|
||||
foreach($goods_cart as $key=>$value){
|
||||
$count+=$value['goods_num'];
|
||||
}
|
||||
if($count + $info['goods_num'] > 2 || $count >2){
|
||||
return '每单限额两套';
|
||||
}
|
||||
|
||||
//购物车内已有该商品
|
||||
$update_data = [
|
||||
'goods_num' => $goods_num + $info['goods_num'],
|
||||
@ -98,7 +109,9 @@ class CartLogic
|
||||
if (self::checkStock($cart['item_id'], $goods_num)) {
|
||||
return '很抱歉,库存不足';
|
||||
}
|
||||
|
||||
if($cart['goods_num'] >= 2){
|
||||
return '每单限额两套';
|
||||
}
|
||||
if ($goods_num <= 0) {
|
||||
$goods_num = 1;
|
||||
}
|
||||
@ -136,7 +149,7 @@ class CartLogic
|
||||
//列表
|
||||
public static function lists($user_id)
|
||||
{
|
||||
$field = 'g.name,g.image,g.id as goods_id,g.status as g_status,g.del as g_del,
|
||||
$field = 'g.name,g.first_category_id,g.image,g.id as goods_id,g.status as g_status,g.del as g_del,
|
||||
i.spec_value_str,i.price,i.image as item_image,c.goods_num,c.selected,c.id as cart_id,c.item_id,i.stock as item_stock';
|
||||
|
||||
$carts = Db::name('cart')->alias('c')
|
||||
|
||||
@ -78,35 +78,35 @@ class GoodsCategoryLogic{
|
||||
}
|
||||
|
||||
//pc端不显示品牌
|
||||
if(1 == $client){
|
||||
$goods_brand = Db::name('goods_brand')
|
||||
->where(['del'=>0,'is_show'=>1])
|
||||
->field('id,name,image')
|
||||
->order('sort desc,id desc')
|
||||
->select();
|
||||
if($goods_brand){
|
||||
foreach ($goods_brand as &$brand_item){
|
||||
$brand_item['type'] = 0;
|
||||
$brand_item['image'] = UrlServer::getFileUrl($brand_item['image']);
|
||||
}
|
||||
|
||||
$brand = [
|
||||
'id' => 0,
|
||||
'name' => '品牌推荐',
|
||||
'type' => 0,
|
||||
'sons' =>[
|
||||
[
|
||||
'id' => 0,
|
||||
'name' => '热门品牌',
|
||||
'type' => 0,
|
||||
'sons' => $goods_brand,
|
||||
|
||||
]
|
||||
],
|
||||
];
|
||||
array_unshift($lists,$brand);
|
||||
}
|
||||
}
|
||||
// if(1 == $client){
|
||||
// $goods_brand = Db::name('goods_brand')
|
||||
// ->where(['del'=>0,'is_show'=>1])
|
||||
// ->field('id,name,image')
|
||||
// ->order('sort desc,id desc')
|
||||
// ->select();
|
||||
// if($goods_brand){
|
||||
// foreach ($goods_brand as &$brand_item){
|
||||
// $brand_item['type'] = 0;
|
||||
// $brand_item['image'] = UrlServer::getFileUrl($brand_item['image']);
|
||||
// }
|
||||
//
|
||||
// $brand = [
|
||||
// 'id' => 0,
|
||||
// 'name' => '品牌推荐',
|
||||
// 'type' => 0,
|
||||
// 'sons' =>[
|
||||
// [
|
||||
// 'id' => 0,
|
||||
// 'name' => '热门品牌',
|
||||
// 'type' => 0,
|
||||
// 'sons' => $goods_brand,
|
||||
//
|
||||
// ]
|
||||
// ],
|
||||
// ];
|
||||
// array_unshift($lists,$brand);
|
||||
// }
|
||||
// }
|
||||
|
||||
Cache::set('goods_category_'.$client, array_values($lists));
|
||||
return array_values($lists);
|
||||
|
||||
@ -166,7 +166,7 @@ class GoodsLogic{
|
||||
//商品规格
|
||||
$goods->GoodsSpec();
|
||||
$goods->append(['comment'])->hidden(['Spec','GoodsSpecValue'])
|
||||
->visible(['id','name','image','video','stock','remark','content','sales_sum','poster',
|
||||
->visible(['id','name','first_category_id','image','video','stock','remark','content','sales_sum','poster',
|
||||
'click_count','min_price','max_price','market_price','is_collect','goods_spec','goods_image',
|
||||
'goods_item','activity','member_price','is_express','is_selffetch','market_price']);
|
||||
|
||||
|
||||
@ -42,6 +42,7 @@ use think\facade\Db;
|
||||
use think\facade\Config;
|
||||
use think\facade\Cache;
|
||||
use think\facade\Hook;
|
||||
use weixin\Getopenid;
|
||||
|
||||
class LoginLogic extends LogicBase
|
||||
{
|
||||
@ -90,13 +91,13 @@ class LoginLogic extends LogicBase
|
||||
// 生成分销会员基础表
|
||||
\app\common\logic\DistributionLogic::add($user->id);
|
||||
|
||||
//注册赠送
|
||||
self::registerAward($user->id);
|
||||
//消息通知
|
||||
Hook::listen('notice', [
|
||||
'user_id' => $user->id,
|
||||
'scene' => NoticeSetting::REGISTER_SUCCESS_NOTICE,
|
||||
]);
|
||||
// //注册赠送
|
||||
// self::registerAward($user->id);
|
||||
// //消息通知
|
||||
// Hook::listen('notice', [
|
||||
// 'user_id' => $user->id,
|
||||
// 'scene' => NoticeSetting::REGISTER_SUCCESS_NOTICE,
|
||||
// ]);
|
||||
return $token;
|
||||
}
|
||||
/**
|
||||
@ -339,6 +340,13 @@ class LoginLogic extends LogicBase
|
||||
->field(['id', 'nickname', 'avatar', 'level', 'disable', 'distribution_code'])
|
||||
->where(['account|mobile' => $post['account']])
|
||||
->find();
|
||||
if($user_info == null){
|
||||
$open=new Getopenid();
|
||||
$open_id=$open->getOpenid($post['code']);
|
||||
$response['openid'] = $open_id['openid'];
|
||||
$response['mobile'] = $post['account'];
|
||||
$user_info = UserServer::createUser($response, Client_::mnp);
|
||||
}
|
||||
$user_info['token'] = self::createSession($user_info['id'], $post['client']);
|
||||
if (empty($user_info['avatar'])) {
|
||||
$user_info['avatar'] = UrlServer::getFileUrl(ConfigServer::get('website', 'user_image'));
|
||||
|
||||
@ -516,12 +516,12 @@ class OrderLogic extends LogicBase
|
||||
$type = $post['type'] ?? '';
|
||||
$order_source = $post['client'];
|
||||
$goods_lists = $data['goods_lists'];
|
||||
$user_address = $data['address'];
|
||||
// $user_address = $data['address'];
|
||||
$user = User::find($user_id);
|
||||
|
||||
if ($post['delivery_type'] != CommonOrder::DELIVERY_STATUS_SELF && empty($data['address'])) {
|
||||
throw new Exception('请选择收货地址');
|
||||
}
|
||||
// if ($post['delivery_type'] != CommonOrder::DELIVERY_STATUS_SELF && empty($data['address'])) {
|
||||
// throw new Exception('请选择收货地址');
|
||||
// }
|
||||
|
||||
if ($post['delivery_type'] == CommonOrder::DELIVERY_STATUS_SELF && empty($post['selffetch_shop_id'])) {
|
||||
throw new Exception('自提门店不能为空');
|
||||
@ -598,10 +598,10 @@ class OrderLogic extends LogicBase
|
||||
$goods_name[] = $val['name'];
|
||||
}
|
||||
}
|
||||
if (!empty($goods_name)) {
|
||||
// throw new Exception('商品:'.implode('、',$goods_name).'不支持快递配送!');
|
||||
throw new Exception('订单存在不支持快递配送的商品!');
|
||||
}
|
||||
// if (!empty($goods_name)) {
|
||||
//// throw new Exception('商品:'.implode('、',$goods_name).'不支持快递配送!');
|
||||
// throw new Exception('订单存在不支持快递配送的商品!');
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@ -611,7 +611,7 @@ class OrderLogic extends LogicBase
|
||||
'consignee'=>($post['delivery_type'] == CommonOrder::DELIVERY_STATUS_SELF) ? $post['consignee'] : '',
|
||||
'mobile'=>($post['delivery_type'] == CommonOrder::DELIVERY_STATUS_SELF) ? $post['mobile'] : ''
|
||||
];
|
||||
$order = self::addOrder($user_id, $data,$post, $order_source, $user_address, $extra);
|
||||
$order = self::addOrder($user_id, $data,$post, $order_source, $user_address="", $extra);
|
||||
$order_id = $order['order_id'];
|
||||
self::addOrderGoods($order_id, $goods_lists);
|
||||
self::addOrderAfter($order_id, $user_id, $type, $data);
|
||||
@ -694,12 +694,12 @@ class OrderLogic extends LogicBase
|
||||
'order_sn' => createSn('order', 'order_sn', '', 4),
|
||||
'user_id' => $user_id,
|
||||
'order_source' => $order_source,
|
||||
'consignee' => $user_address['contact'],
|
||||
'province' => $user_address['province_id'],
|
||||
'city' => $user_address['city_id'],
|
||||
'district' => $user_address['district_id'],
|
||||
'address' => $user_address['address'],
|
||||
'mobile' => $user_address['telephone'],
|
||||
// 'consignee' => $user_address['contact'],
|
||||
// 'province' => $user_address['province_id'],
|
||||
// 'city' => $user_address['city_id'],
|
||||
// 'district' => $user_address['district_id'],
|
||||
// 'address' => $user_address['address'],
|
||||
// 'mobile' => $user_address['telephone'],
|
||||
'goods_price' => $data['total_goods_price'],
|
||||
'order_amount' => $data['order_amount'],//应付金额
|
||||
'total_amount' => $data['total_amount'],//订单总金额
|
||||
@ -926,7 +926,11 @@ class OrderLogic extends LogicBase
|
||||
}
|
||||
|
||||
public static function getYuyueTime($data){
|
||||
return Db::name("order_yuyetime")->where("store_id",$data['store_id'])->select()->toArray();
|
||||
return Db::name("order_yuyetime")
|
||||
->where("store_id",$data['store_id'])
|
||||
->orderRaw("STR_TO_DATE(start_time, '%H:%i')")
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -53,7 +53,7 @@ class UserServer
|
||||
$unionid = $response['unionid'] ?? '';
|
||||
$avatar_url = $response['headimgurl'] ?? '';
|
||||
$nickname = $response['nickname'] ?? '';
|
||||
|
||||
$mobile = $response['mobile'] ?? '';
|
||||
Db::startTrans();
|
||||
|
||||
// 获取存储引擎
|
||||
@ -84,6 +84,8 @@ class UserServer
|
||||
'sn' => create_user_sn(),
|
||||
'avatar' => $avatar,
|
||||
'create_time' => $time,
|
||||
'mobile' => $mobile,
|
||||
'account' => $mobile,
|
||||
'distribution_code' => generate_invite_code(),//分销邀请码
|
||||
'is_distribution' => DistributionLogic::isDistributionMember(),
|
||||
// 微信新用户
|
||||
|
||||
34
app/common/model/Device.php
Normal file
34
app/common/model/Device.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Device模型
|
||||
* Class Device
|
||||
* @package app\common\model
|
||||
*/
|
||||
class Device extends BaseModel
|
||||
{
|
||||
|
||||
protected $name = 'device';
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user