Commit 657a5ceb by liwotianname

Merge branch 'master' of http://139.199.22.180/tencent/services

parents fe840a6a dea1ceae
......@@ -9,8 +9,8 @@ namespace Hdll\Services\Auth\Enum;
class AuthError
{
const GET_TOKEN_ERROR = ["msg" => "获取token失败", "code" => 500, "errorCode" => 25103];
const NOT_FOUND_USER = ["msg" => "获取用户信息失败", "code" => 404, "errorCode" => 25104];
const GET_TOKEN_ERROR = ["msg" => "获取token失败", "code" => 401, "errorCode" => 25103];
const NOT_FOUND_USER = ["msg" => "获取用户信息失败", "code" => 401, "errorCode" => 25104];
public static function atranslate($message,$param)
......
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/9/30
* Time: 9:50
*/
namespace Hdll\Services\Buyer\Lib;
use Swoft\Core\ResultInterface;
/**
* @method ResultInterface deferDelByStoreId(int $storeId)
* Interface Footprint
* @package Hdll\Services\Buyer\Lib
*/
interface FootprintInterface
{
public function delByStoreId(int $storeId) : bool;
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Argericy
* Date: 2018/7/23
* Time: 15:54
*/
namespace App\Models\Dao;
use App\Models\Entity\{entityName};
use Swoft\Bean\Annotation\Bean;
use Hdll\Services\Common\Exception\CommonException;
/**
* @Bean()
* Class {className}
* @package App\Models\Dao
*/
class {className}
{
public function create(array $info) : {entityName}
{
${varEntityName} = new {entityName}($info);
$res = ${varEntityName}->save()->getResult();
if ( $res === false ) {
throw new CommonException(["msg" => "数据库操作错误", "code" => 500]);
}
return ${varEntityName};
}
public function selectInfoByCondition($condition, $field)
{
return {entityName}::findAll($condition, ['fields' => $field])->getResult();
}
public function getInfoByCondition($condition, $field)
{
return {entityName}::findOne($condition, ['fields' => $field])->getResult();
}
/**
* 根据条件更新信息
* @param $condition
* @param $updateInfo
* @return mixed
*/
public function updateByCondition($condition, $updateInfo)
{
return {entityName}::updateAll($updateInfo, $condition)->getResult();
}
/**
* 更新一条记录
*
* @param $condition
* @param $updateInfo
* @return mixed
*/
public function updateOne($condition, $updateInfo)
{
return {entityName}::updateOne($updateInfo, $condition)->getResult();
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Argericy
* Date: 2018/9/29
* Time: 11:35
*/
namespace App\Models\Data;
use App\Models\Dao\{daoName};
use Swoft\Bean\Annotation\Bean;
use Swoft\Bean\Annotation\Inject;
/**
* @Bean()
*
* Class {dataName}
* @package App\Models\Data
*/
class {dataName}
{
/**
* @Inject()
* @var {daoName}
*/
private ${varDaoName};
}
\ No newline at end of file
<?php
/**
* This file is part of Swoft.
*
* @link https://swoft.org
* @document https://doc.swoft.org
* @contact group@swoft.org
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Commands\Common;
use Swoft\Console\Bean\Annotation\Command;
use Swoft\Console\Bean\Annotation\Mapping;
use Swoft\Console\Input\Input;
use Swoft\Console\Output\Output;
/**
* generate dao,data layer commands
*
* @Command(coroutine=false)
*/
class GenerateCommand
{
/**
* this generate command
*
* @Usage
* generate:dao [options]
*
* @Options
* -n,--n the dao name
* -e,--e the entity name
*
* @Example
* php swoft generate:dao -e entityName [-n daoName]
*
* @param Input $input
* @param Output $output
*
* @Mapping("dao")
*/
public function Dao(Input $input, Output $output)
{
$className = $input->getOpt('n');
$entityName = $input->getOpt('e');
$this->generateDao($output, $className, $entityName);
}
/**
* this generate command
*
* @Usage
* generate:all [options]
*
* @Options
* -n,--n the dao name
* -e,--e the entity name
*
* @Example
* php swoft generate:dao -e entityName [-n dataName] [--dao-name daoName]
*
* @param Input $input
* @param Output $output
*
* @Mapping("all")
*/
public function all(Input $input, Output $output)
{
$dataName = $input->getOpt('n');
$entityName = $input->getOpt('e');
$daoName = $input->getOpt('dao-name');
$appPath = alias('@app');
$dataName = empty($dataName)?$entityName.'Data':$dataName;
//generateDao
$daoName = empty($daoName)?$entityName.'Dao':$daoName;
$this->generateDao($output, $daoName, $entityName);
//generateData
$dataPath = $appPath.'/Models/Data/'.$dataName.'.php';
$templatePath = $appPath.'/Commands/Common/ClassTemplate/Data/ClassTemplate';
$content = file_get_contents($templatePath);
$content = str_replace('{dataName}', $dataName, $content);
$content = str_replace("{daoName}", $daoName, $content);
$content = str_replace("{varDaoName}", lcfirst($daoName), $content);
file_put_contents($dataPath, $content);
}
private function generateDao($output,$daoName, $entityName)
{
if ( empty($entityName) ) {
$output->writeln("the en option is required", true, true);
}
$daoName = empty($daoName)?$entityName.'Dao':$daoName;
$daoPath = alias("@app").'/Models/Dao/'.$daoName.'.php';
$templatePath = alias("@app").'/Commands/Common/ClassTemplate/Dao/ClassTemplate';
$content = file_get_contents($templatePath);
$content = str_replace("{className}", $daoName,$content);
$content = str_replace("{entityName}", $entityName, $content);
$content = str_replace("{varEntityName}", lcfirst($entityName), $content);
file_put_contents($daoPath,$content);
}
}
\ No newline at end of file
......@@ -38,7 +38,6 @@ class LogHandler extends AbstractProcessingHandler
}
$lines = array_column($records, 'formatted');
$this->write($lines);
}
......@@ -77,6 +76,11 @@ class LogHandler extends AbstractProcessingHandler
}
$record = $this->processRecord($record);
$search1 = strpos($record['messages'], '[http://testapi.2b3.cn:80/]');
$search2 = strpos($record['messages'], '[http://api.2b3.cn:80/]');
if($search1 !== false || $search2 !== false) {
continue;
}
$record['formatted'] = $this->getFormatter()->format($record);
$messages[] = $record;
......
......@@ -32,4 +32,6 @@ class NoticeEnum
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/9/28
* Time: 14:50
*/
namespace Hdll\Services\Notice\Enum;
class RedisKeyEnum
{
const PREFIX = "notice:";
const ORDER_RESERVATION = self::PREFIX."order_reservation_";
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/9/6
* Time: 10:23
*/
namespace Hdll\Services\Notice\Extensions\Notice;
use Hdll\Services\Notice\Common\WxMiniNotice;
use Hdll\Services\Notice\Enum\NoticeEnum;
class MiniBackendSender implements SenderInterface
{
private $sendType = NoticeEnum::TYPE_MINI_BACKEND_SEND;
private $data;
private $user;
private $page;
private $sendData;
private $template;
public function __construct(array $user,array $page, array $sendData, string $template)
{
$this->user = $user;
$this->page = $page;
$this->sendData = $sendData;
$this->template = $template;
}
/**
* 格式化数据
*/
public function format()
{
//$sendType
$this->data[$this->sendType] = [
"uid" => $this->user['id'], //用户的id
"template_id" => $this->template,//消息模板id
"page" => WxMiniNotice::generatePage(
$this->page['page'],
$this->page['param']
), //消息模板页面
];
foreach ( $this->sendData as $key => $data ) {
$key +=1;
$this->data[$this->sendType]['data']["keyword{$key}"]['value'] = $data;
}
}
/**
* 获取发送数据
*
* @return mixed
*/
public function getData ()
{
return $this->data;
}
/**
* 获取发送类型
*
* @return array
*/
public function getSendType()
{
return [$this->sendType];
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/9/6
* Time: 10:23
*/
namespace Hdll\Services\Notice\Extensions\Notice;
use Hdll\Services\Notice\Common\WxMiniNotice;
use Hdll\Services\Notice\Enum\NoticeEnum;
/**
* Class MiniFrontendSender
* @package Hdll\Services\Notice\Extensions\Notice
*/
class MiniFrontendSender implements SenderInterface
{
private $sendType = NoticeEnum::TYPE_MINI_FRONTEND_SEND;
private $data;
private $user;
private $page;
private $sendData;
private $template;
/**
*
* $send = new MiniFrontendSender( ['id' => 1, 'storeId' => 198],
* [
* 'page' => 'pages/orderShow/orderShow',
* 'param' => ['orderId' => 1, 'storeId' => 168]
* ],
* [
* 1 => 'aaaaaaa',
* 2 => 'msg',
* 3 => '您好,您申请的退款不符合条件被拒绝',
* ],
* 'jcqYc-gHjkv-T8pDW8wjYFha0TKzCJTV3yNeGY3JW-0'
* );
* MiniFrontendSender constructor.
*
* @param array $user
* @param array $page
* @param array $sendData
* @param string $template
*/
public function __construct(array $user,array $page, array $sendData, string $template)
{
$this->user = $user;
$this->page = $page;
$this->sendData = $sendData;
$this->template = $template;
}
/**
* 格式化数据
*/
public function format()
{
//$sendType
$this->data[$this->sendType] = [
"uid" => $this->user['id'], //用户的id
"storeId" => $this->user['storeId'], //店铺的id
"template_id" => $this->template,//消息模板id
"page" => WxMiniNotice::generatePage(
$this->page['page'],
$this->page['param']
), //消息模板页面
];
foreach ( $this->sendData as $key => $data ) {
$key +=1;
$this->data[$this->sendType]['data']["keyword{$key}"]['value'] = $data;
}
}
/**
* 获取发送数据
*
* @return mixed
*/
public function getData ()
{
return $this->data;
}
/**
* 获取发送类型
*
* @return array
*/
public function getSendType()
{
return [$this->sendType];
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/10/9
* Time: 10:50
*/
namespace Hdll\Services\Notice\Extensions\Notice;
use Hdll\Services\Notice\Common\WxMiniNotice;
use Hdll\Services\Notice\Enum\NoticeEnum;
class MpSender implements SenderInterface
{
private $sendType = NoticeEnum::TYPE_MP_SEND;
private $data;
private $unionId;
private $miniprogram;
private $sendData;
private $template;
public function __construct(string $unionId,array $miniprogram, array $sendData, string $template)
{
$this->unionId = $unionId;
$this->miniprogram = $miniprogram;
$this->sendData = $sendData;
$this->template = $template;
}
public function format()
{
$this->data[$this->sendType] = [
'unionId' => $this->unionId,
'template_id' => $this->template,
'miniprogram' => [
'appid' => $this->miniprogram['appId'], //小程序appid
'pagepath' => WxMiniNotice::generatePage(
$this->miniprogram['page'],
$this->miniprogram['param']
)//小程序页面
],
'data' => $this->sendData
];
}
public function getData()
{
return $this->data;
}
public function getSendType()
{
return [$this->sendType];
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/9/6
* Time: 10:21
*/
namespace Hdll\Services\Notice\Extensions\Notice;
interface SenderInterface
{
public function format();
public function getData ();
public function getSendType();
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/9/10
* Time: 14:53
*/
namespace Hdll\Services\Notice\Extensions\Notice;
use Hdll\Services\Notice\Enum\NoticeEnum;
class TencentSMS implements SenderInterface
{
private $sendType = NoticeEnum::TYPE_TENCENT_SMS;
private $data;
private $phone;
private $template;
private $param;
public function __construct(string $phone, string $template, array $param)
{
$this->phone = $phone;
$this->template = $template;
$this->param = $param;
}
public function format()
{
$this->data[$this->sendType] = [
[
'templateId' => $this->template,
'phoneNumber' => $this->phone,
'param' => $this->param,
]
];
}
public function getData()
{
$this->data;
}
public function getSendType()
{
return [$this->sendType];
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/10/9
* Time: 9:22
*/
namespace Hdll\Services\Notice\Extensions;
use Hdll\Services\Notice\Extensions\Notice\SenderInterface;
use Hdll\Services\Notice\Lib\NoticeInterface;
class NoticeExtension
{
private $notice;
public function __construct(NoticeInterface $notice)
{
$this->notice = $notice;
}
/**
* 发送消息通知
*
* @param int $sendTime
* @param mixed ...$senders
* @return bool|mixed
*/
public function send(int $sendTime, ... $senders)
{
$data = [];
$sendType = [];
foreach ( $senders as $sender ) {
if ( ! $sender instanceof SenderInterface) {
continue;
}
if ( in_array($sender->getSendType(), $sendType) ) {
continue;
}
$sender->format();
$data += $sender->getData();
$sendType += $sender->getSendType();
}
return $this->notice->send($sendType, $data, $sendTime);
}
}
\ No newline at end of file
......@@ -15,7 +15,8 @@ use Swoft\Core\ResultInterface;
/**
* The interface of demo service
*
* @method ResultInterface deferSend(int $storeId, array $sendTypes, array $data, int $sendTime) :bool
* @method ResultInterface deferSend(int $storeId, array $sendTypes, array $data, int $sendTime, string $redisKey) :bool
* @method ResultInterface deferCancelSend(int $storeId, array $sendTypes, array $data, int $sendTime, string $redisKey) :bool
*/
interface NoticeInterface
{
......@@ -60,7 +61,7 @@ interface NoticeInterface
*
* 微信公众号发送实例
$data[NoticeEnum::TYPE_MP_SEND] = [
'touser' => 'o3lFcs8xoWfQUlhzTiP5uZI6A7Hc', //这里要填写公众号的openId
'unionId' => 'o3lFcs8xoWfQUlhzTiP5uZI6A7Hc', //填写用户的unionId
'template_id' => 'zwUBuoKVRJkumLwGkippA46XfmLsmwJD906HC-wqOks',
'miniprogram' => [
'appid' => 'wx3b3b2df942634cdd', //小程序appid
......@@ -80,7 +81,17 @@ interface NoticeInterface
* @param array $sendTypes
* @param array $data
* @param int $sendTime //发送时间,立即返送填0
* @param string $redisKey //发送事件的redis key(如果定时发送消息,中途需要取消则需要传入此项)
* @return mixed
*/
public function send(array $sendTypes, array $data, int $sendTime) :bool;
public function send(array $sendTypes, array $data, int $sendTime, string $redisKey='') :bool;
/**
* 取消定时消息发送
*
* @param string $redisKey
* @return bool
*/
public function cancelSend(string $redisKey):bool ;
}
\ No newline at end of file
......@@ -23,6 +23,7 @@ use Swoft\Core\ResultInterface;
* @method ResultInterface deferUpdateInfoByIds(int $storeId,array $orderIds, array $updateInfo)
* @method ResultInterface deferCollectionClose(int $storeId, int $orderId)
* @method ResultInterface deferGetOtherInfo(int $storeId, string $orderSn, array $consigneeFields = [], array $itemFields = [])
* @method ResultInterface deferGetList(int $storeId,array $ids)
*/
interface OrderInterface
{
......@@ -150,4 +151,82 @@ interface OrderInterface
*/
public function getOtherInfo(int $storeId, string $orderSn, array $consigneeFields = [], array $itemFields = []);
/**
* 批量获取订单信息
* [5]=>
* array(28) {
["id"]=>
string(1) "1"
["orderSn"]=>
string(20) "198bSA93091872375217"
["paySn"]=>
string(28) "4200000198201809300361147593"
["orderType"]=>
string(1) "0"
["storeId"]=>
string(3) "198"
["buyerId"]=>
string(1) "1"
["itemId"]=>
string(1) "1"
["consigneeId"]=>
string(1) "1"
["goodsAmount"]=>
string(1) "1"
["orderAmount"]=>
string(1) "1"
["actualAmount"]=>
string(1) "1"
["refundAmount"]=>
string(1) "1"
["state"]=>
string(2) "60"
["refundState"]=>
string(1) "2"
["refundMsg"]=>
string(30) "身体不适,暂时不做了"
["lockState"]=>
string(1) "0"
["lockMsg"]=>
string(0) ""
["balanceState"]=>
string(1) "0"
["balanceTime"]=>
string(1) "0"
["message"]=>
string(0) ""
["reservationTime"]=>
string(1) "0"
["createTime"]=>
string(10) "1538291872"
["updateTime"]=>
string(10) "1538291953"
["deleteTime"]=>
string(1) "0"
["sellerId"]=>
string(1) "6"
["deliveredTime"]=>
string(1) "0"
["commission"]=>
string(1) "0"
["items"]=>
array(1) {
[0]=>
array(2) {
["name"]=>
string(7) "商品1"
["image"]=>
string(72) "store-198/goods/tmp_7d07ba3c8e10c3cd65de8d98d00cbd5aace9e736ddde0c59.jpg"
}
}
}
}
*
* @param int $storeId
* @param array $ids
* @return mixed
*/
public function getList(int $storeId,array $ids);
}
\ No newline at end of file
......@@ -18,8 +18,9 @@ use Swoft\Core\ResultInterface;
*
* @method ResultInterface deferGetReservById(int $storeId, int $id)
* @method ResultInterface deferIsReserved(int $storeId, int $cmanId, int $reservTime)
* @method ResultInterface deferGetReservListByOrderId(int $storeId, int $orderId, int $state = 0)
* @method ResultInterface deferGetReservListByOrderId(int $storeId, int $orderId, $state = null)
* @method ResultInterface deferModifyReservById(int $storeId, int $id, array $data)
* @method ResultInterface defermarkReservFinished(int $storeId, int $orderId)
* @method ResultInterface deferAddReservation(int $storeId, int $orderId, int $buyerId, int $cmanId, int $reservTime, string $memo, int $type)
* @method ResultInterface deferCancelReservById(int $storeId, int $id)
* @method ResultInterface deferCancelReservByOrderId(int $storeId, int $orderId)
......@@ -55,7 +56,7 @@ interface ReservationInterface
* @param integer $state
* @return array
*/
public function getReservListByOrderId(int $storeId, int $orderId, int $state = 0);
public function getReservListByOrderId(int $storeId, int $orderId, $state = null);
/**
* 修改某个预约信息
......@@ -72,6 +73,16 @@ interface ReservationInterface
public function modifyReservById(int $storeId, int $id, array $data);
/**
* 根据orderId标记订单下所有预约的状态为“已完成”
*
* @param integer $storeId
* @param integer $orderId
* @Number(name="orderId")
* @return bool 返回操作结果,true操作成功
*/
public function markReservFinished(int $storeId, int $orderId);
/**
* 添加预约
*
* @param integer $storeId
......
......@@ -14,6 +14,7 @@ use Swoft\Core\ResultInterface;
* @method ResultInterface deferSave($referId, $unionId, $openId, $nickName, $headImgUrl)
* @method ResultInterface deferGet($id,$fields=['*'])
* @method ResultInterface deferGetByUnionId($unionId,$fields=['*'])
* @method ResultInterface deferGetByStoreId($storeId,$fields=['*'])
* @method ResultInterface deferUpdate($id,$data)
* Interface SellerInterface
* @package App\Lib
......@@ -65,4 +66,12 @@ interface SellerInterface
*/
public function update($condition,$data);
/**
* @param $storeId
* @param array $fields
* @return mixed
* @author Administrator
*/
public function getByStoreId($storeId, $fields = ['*']);
}
\ No newline at end of file
......@@ -16,6 +16,7 @@ use Swoft\Core\ResultInterface;
* The interface of store service
*
* @method ResultInterface deferIsCertified(int $storeId)
* @method ResultInterface deferIsNormal(int $storeId)
* @method ResultInterface deferGetStoreByStoreId(int $storeId)
* @method ResultInterface deferGetStoreBySellerId(int $sellerId)
* @method ResultInterface deferGetStoreByMobile(int $mobile, array $fields = [])
......@@ -29,11 +30,20 @@ interface StoreInterface
* 查询店铺是否已实名认证(企业认证)
*
* @param integer $storeId
* @return boolean
* @return bool true:认证成功 false:未认证
*/
public function isCertified(int $storeId);
/**
* 查询店铺是否正常
*
* @Number(name="storeId")
* @param integer $storeId
* @return bool true:正常,false:冻结
*/
public function isNormal(int $storeId);
/**
* 根据店铺ID获取店铺信息
*
* @param integer $storeId
......
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