lqmac 4 months ago
parent 681267566b
commit 2ae77cf88f
  1. 28
      app/api/controller/Passport.php
  2. 11
      app/api/service/Setting.php
  3. 65
      app/api/service/passport/Login.php
  4. 8
      app/common/enum/payment/Method.php
  5. 6
      app/common/model/Goods.php
  6. 11
      app/common/model/Payment.php
  7. 4
      app/common/model/store/Setting.php
  8. 5
      app/common/service/GoodsCateEs.php
  9. 4
      app/job/service/goods/Collector.php
  10. 6
      app/store/controller/Setting.php
  11. 18
      app/store/controller/setting/payment/Template.php

@ -27,6 +27,34 @@ use cores\exception\BaseException;
*/
class Passport extends Controller
{
public function accountLogin(){
$params = $this->postForm();
// 执行登录
$LoginService = new LoginService;
if (!$LoginService->accountLogin($params)) {
return $this->renderError($LoginService->getError());
}
// 用户信息
$userInfo = $LoginService->getUserInfo();
return $this->renderSuccess([
'userId' => (int)$userInfo['user_id'],
'token' => $LoginService->getToken((int)$userInfo['user_id'])
], '登录成功');
}
public function accountRegister(){
$params = $this->postForm();
// 执行登录
$LoginService = new LoginService;
if (!$LoginService->accountRegister($params)) {
return $this->renderError($LoginService->getError());
}
// 用户信息
$userInfo = $LoginService->getUserInfo();
return $this->renderSuccess([
'userId' => (int)$userInfo['user_id'],
'token' => $LoginService->getToken((int)$userInfo['user_id'])
], '登录成功');
}
/**
* 登录接口 (需提交手机号、短信验证码、第三方用户信息)
* @return Json

@ -16,7 +16,7 @@ use app\api\model\Setting as SettingModel;
use app\common\enum\Setting as SettingEnum;
use app\common\library\helper;
use app\common\service\BaseService;
use app\common\model\UploadFile;
/**
* 服务类:商城设置
* Class Setting
@ -64,8 +64,13 @@ class Setting extends BaseService
$data[SettingEnum::REGISTER] = $this->getRegister();
// 商品推荐设置
$data[SettingEnum::RECOMMENDED] = $this->getRecommended();
// 商品推荐设置
$data[SettingEnum::CUSTOMER] = $this->getCustomer();
// 客服
$customer = $this->getCustomer();
if (isset($customer['config']['ewmkf']['qrCodeId']) && $customer['config']['ewmkf']['qrCodeId']) {
$info = UploadFile::detail($customer['config']['ewmkf']['qrCodeId']);
$customer['config']['ewmkf']['qrCode'] = $info['preview_url'] ?? "";
}
$data[SettingEnum::CUSTOMER] = $customer;
return $data;
}

@ -43,7 +43,67 @@ class Login extends BaseService
// 用于生成token的自定义盐
const TOKEN_SALT = 'user_salt';
/**
* 执行用户登录
* @param array $data
* @return bool
* @throws BaseException
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function accountLogin(array $data): bool
{
$data['partyData']['code'] = "";
$data['partyData']['oauth'] = "";
$data['isParty'] = false;
$userInfo = UserModel::detail(['mobile' => $data['mobile']]);
if (!$userInfo) {
throwError("账号不存在");
}
if ($userInfo['password'] && ($userInfo['password'] != md5($data['password']))) {
throwError("密码不正确");
}
$this->updateUser($userInfo, $data['isParty'], $data['partyData']);
// 记录登录态
return $this->setSession();
}
/**
* 执行用户登录
* @param array $data
* @return bool
* @throws BaseException
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function accountRegister(array $data): bool
{
$data['partyData']['code'] = "";
$data['partyData']['oauth'] = "";
$data['isParty'] = false;
// 自动登录注册
// 查询用户是否已存在
// 用户存在: 更新用户登录信息
$userInfo = UserModel::detail(['mobile' => $data['mobile']]);
if ($userInfo) {
throwError("账号已存在");
}
// 推荐人ID
$refereeId = 0;
if (!empty($data['refereeId'])) {
$refereeId = intval($data['refereeId']);
}
$data['partyData']['password'] = $data['password'];
// 用户不存在: 创建一个新用户
$this->createUser($data['mobile'], $data['isParty'], $data['partyData'], $refereeId);
// 记录登录态
return $this->setSession();
}
/**
* 执行用户登录
* @param array $data
@ -409,8 +469,11 @@ class Login extends BaseService
'nick_name' => !empty($mobile) ? \hide_mobile($mobile) : '',
'platform' => \getPlatform(),
'last_login_time' => \time(),
'store_id' => $this->storeId
'store_id' => $this->storeId,
];
if (isset($partyData['password']) && $partyData['password']) {
$data['password'] = md5($partyData['password']);
}
// 写入用户信息(第三方)
if ($isParty === true && !empty($partyData)) {
$partyUserInfo = PartyService::partyUserInfo($partyData, true);

@ -29,8 +29,10 @@ class Method extends EnumBasics
// 余额支付
const BALANCE = 'balance';
//银联支付
const HUIFU = 'huifu';
//支付凭证
const VOUCHER = 'voucher';
/**
* 获取类型值
@ -51,6 +53,10 @@ class Method extends EnumBasics
'name' => '银联支付',
'value' => self::HUIFU,
],
self::VOUCHER => [
'name' => '支付凭证',
'value' => self::VOUCHER,
],
self::BALANCE => [
'name' => '余额支付',
'value' => self::BALANCE,

@ -213,7 +213,11 @@ class Goods extends BaseModel
->where('is_delete', '=', 0)
->order($sort)
->paginate($listRows);
foreach ($list as &$goods) {
if (!$goods->link_other) {
$goods->link_other = "0";
}
}
// 整理列表数据并返回
return $list;
}

@ -198,11 +198,12 @@ class Payment extends BaseModel
PaymentMethodEnum::BALANCE,
]),
// ClientEnum::H5 => $this->defaultGroup(ClientEnum::H5, [
ClientEnum::H5 => $this->defaultGroup(ClientEnum::H5, [
// PaymentMethodEnum::WECHAT,
// PaymentMethodEnum::ALIPAY,
// PaymentMethodEnum::BALANCE,
// ]),
PaymentMethodEnum::VOUCHER,
PaymentMethodEnum::BALANCE,
]),
// ClientEnum::WXOFFICIAL => $this->defaultGroup(ClientEnum::WXOFFICIAL, [
// PaymentMethodEnum::WECHAT,
// PaymentMethodEnum::BALANCE,
@ -301,9 +302,13 @@ class Payment extends BaseModel
$group = static::getItem($client, $storeId, $merchantId);
$methods = [];
foreach ($group['methods'] as $method) {
if ($method['method'] == PaymentMethodEnum::VOUCHER) {
$method['template'] = $this->getTemplateInfo($method['template_id']);
}
if ($method['is_enable'] && ($balance || $method['method'] !== PaymentMethodEnum::BALANCE)) {
$methods[] = $method;
}
}
if (empty($methods)) {
throwError('很抱歉,当前没有可用的支付方式,请检查后台支付设置');

@ -442,6 +442,10 @@ class Setting extends BaseModel
'wxqykf' => [
'url' => '', // 客服链接
'corpId' => '' // 企业ID
],
'ewmkf' => [
'qrCodeId' => '', // 客服链接
'qrCode' => '' // 企业ID
]
]
]

@ -4,7 +4,7 @@ namespace app\common\service;
use app\common\library\elasticsearch\Client;
use app\common\model\GoodsCategoryRel;
use app\common\model\Goods;
use app\api\model\Goods;
use think\Exception;
use app\common\library\helper;
@ -84,7 +84,8 @@ class GoodsCateEs
$goods_list = array_column($data['data'], null, "goods_id");
// var_dump($goods_ids);
// exit();
$list = $model->getListByIds($goods_ids, 10);
//$list = $model->getListByIds($goods_ids, 10);
$list = $model->getListByIdsFromApi($goods_ids);
if ($list) {
foreach ($list as &$value) {
$value['highlight_goods_name'] = $goods_list[$value['goods_id']]['highlight_goods_name'] ?? "";

@ -202,7 +202,9 @@ class Collector extends BaseService
*/
public function single(string $url, array $form, int $storeId): bool
{
if (!$url) {
return true;
}
try {
//var_dump($url);
// 采集第三方商品数据

@ -14,6 +14,7 @@ namespace app\store\controller;
use app\store\model\Setting as SettingModel;
use think\response\Json;
use app\common\model\UploadFile;
/**
* 系统设置
@ -33,6 +34,11 @@ class Setting extends Controller
public function detail(string $key): Json
{
$values = SettingModel::getItem($key, $this->storeId, $this->merchantId);
if (isset($values['config']['ewmkf']['qrCodeId']) && $values['config']['ewmkf']['qrCodeId']) {
$info = UploadFile::detail($values['config']['ewmkf']['qrCodeId']);
$values['config']['ewmkf']['qrCode'] = $info['preview_url'] ?? "";
}
return $this->renderSuccess(compact('values'));
}

@ -16,7 +16,7 @@ use think\response\Json;
use app\store\controller\Controller;
use app\store\model\PaymentTemplate as PaymentTemplateModel;
use think\db\exception\DbException;
use app\common\model\UploadFile;
/**
* 支付模板设置
* Class Template
@ -57,6 +57,22 @@ class Template extends Controller
public function detail(int $templateId): Json
{
$detail = PaymentTemplateModel::detail($templateId);
if ($detail->isEmpty()) {
return $this->renderSuccess(compact('values'));
}
$detail = $detail->toArray();
if (isset($detail['config']['voucher']['alipayQrCodeId']) && $detail['config']['voucher']['alipayQrCodeId']) {
$info = UploadFile::detail($detail['config']['voucher']['alipayQrCodeId']);
$detail['config']['voucher']['alipayQrcode'] = $info['preview_url'] ?? "";
}
if (isset($detail['config']['voucher']['quickpayQrCodeId']) && $detail['config']['voucher']['quickpayQrCodeId']) {
$info = UploadFile::detail($detail['config']['voucher']['quickpayQrCodeId']);
$detail['config']['voucher']['quickpayQrCode'] = $info['preview_url'] ?? "";
}
if (isset($detail['config']['voucher']['wechatQrCodeId']) && $detail['config']['voucher']['wechatQrCodeId']) {
$info = UploadFile::detail($detail['config']['voucher']['wechatQrCodeId']);
$detail['config']['voucher']['wechatQrCode'] = $info['preview_url'] ?? "";
}
return $this->renderSuccess(compact('detail'));
}

Loading…
Cancel
Save