初始化
commit
c088a4276b
|
|
@ -0,0 +1,15 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[*.{yml,yaml}]
|
||||||
|
indent_size = 2
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
APP_NAME=Laravel
|
||||||
|
APP_ENV=local
|
||||||
|
APP_KEY=base64:aWVRFh0raBwuGPNNWiCdXZa7lWN8vCEOIE4+dZM0Q64=
|
||||||
|
APP_DEBUG=true
|
||||||
|
APP_URL=http://localhost
|
||||||
|
APP_FILE_URL=http://jingcai.quickfly.eu.org:3000
|
||||||
|
APP_DOWN_URL=http://jingcai.quickfly.eu.org:3000
|
||||||
|
LOG_CHANNEL=daily
|
||||||
|
LOG_LEVEL=info
|
||||||
|
|
||||||
|
DB_CONNECTION=mysql
|
||||||
|
DB_HOST=127.0.0.1
|
||||||
|
DB_PORT=3306
|
||||||
|
DB_DATABASE=jingcai
|
||||||
|
DB_USERNAME=root
|
||||||
|
DB_PASSWORD=aBc@123456
|
||||||
|
|
||||||
|
BROADCAST_DRIVER=log
|
||||||
|
CACHE_DRIVER=file
|
||||||
|
QUEUE_CONNECTION=sync
|
||||||
|
SESSION_DRIVER=file
|
||||||
|
SESSION_LIFETIME=120
|
||||||
|
|
||||||
|
REDIS_HOST=127.0.0.1
|
||||||
|
REDIS_PASSWORD=null
|
||||||
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
MAIL_MAILER=smtp
|
||||||
|
MAIL_HOST=smtp.mailtrap.io
|
||||||
|
MAIL_PORT=2525
|
||||||
|
MAIL_USERNAME=null
|
||||||
|
MAIL_PASSWORD=null
|
||||||
|
MAIL_ENCRYPTION=null
|
||||||
|
MAIL_FROM_ADDRESS=null
|
||||||
|
MAIL_FROM_NAME="${APP_NAME}"
|
||||||
|
|
||||||
|
AWS_ACCESS_KEY_ID=
|
||||||
|
AWS_SECRET_ACCESS_KEY=
|
||||||
|
AWS_DEFAULT_REGION=us-east-1
|
||||||
|
AWS_BUCKET=
|
||||||
|
|
||||||
|
PUSHER_APP_ID=
|
||||||
|
PUSHER_APP_KEY=
|
||||||
|
PUSHER_APP_SECRET=
|
||||||
|
PUSHER_APP_CLUSTER=mt1
|
||||||
|
|
||||||
|
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||||
|
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||||
|
|
||||||
|
JWT_SECRET=0d7jvRLDmLglfeW3nDaJaMZUr25aqMiCQA5Vn2Yx8SAfAeDyxC5TgVPS8ig0VlZh
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
APP_NAME=Laravel
|
||||||
|
APP_ENV=production
|
||||||
|
APP_KEY=base64:aWVRFh0raBwuGPNNWiCdXZa7lWN8vCEOIE4+dZM0Q64=
|
||||||
|
APP_DEBUG=true
|
||||||
|
APP_URL=
|
||||||
|
|
||||||
|
APP_FILE_URL=http://file.daxiangzj.com
|
||||||
|
BUYER_DOMAIN=http://buyer.daxiangzj.com
|
||||||
|
APP_DOWN_URL=https://file.daxiangzj.com
|
||||||
|
|
||||||
|
LOG_CHANNEL=daily
|
||||||
|
LOG_LEVEL=info
|
||||||
|
|
||||||
|
DB_CONNECTION=mysql
|
||||||
|
DB_HOST=10.206.0.9
|
||||||
|
DB_PORT=3306
|
||||||
|
DB_DATABASE=jingcai
|
||||||
|
DB_USERNAME=jingcai
|
||||||
|
DB_PASSWORD=yLPYX4rWo4n4bwIUGzjM
|
||||||
|
|
||||||
|
BROADCAST_DRIVER=log
|
||||||
|
CACHE_DRIVER=file
|
||||||
|
QUEUE_CONNECTION=redis
|
||||||
|
SESSION_DRIVER=file
|
||||||
|
SESSION_LIFETIME=120
|
||||||
|
|
||||||
|
REDIS_HOST=redis
|
||||||
|
REDIS_PASSWORD=null
|
||||||
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
MAIL_MAILER=smtp
|
||||||
|
MAIL_HOST=smtp.mailtrap.io
|
||||||
|
MAIL_PORT=2525
|
||||||
|
MAIL_USERNAME=null
|
||||||
|
MAIL_PASSWORD=null
|
||||||
|
MAIL_ENCRYPTION=null
|
||||||
|
MAIL_FROM_ADDRESS=null
|
||||||
|
MAIL_FROM_NAME="${APP_NAME}"
|
||||||
|
|
||||||
|
AWS_ACCESS_KEY_ID=
|
||||||
|
AWS_SECRET_ACCESS_KEY=
|
||||||
|
AWS_DEFAULT_REGION=us-east-1
|
||||||
|
AWS_BUCKET=
|
||||||
|
|
||||||
|
PUSHER_APP_ID=
|
||||||
|
PUSHER_APP_KEY=
|
||||||
|
PUSHER_APP_SECRET=
|
||||||
|
PUSHER_APP_CLUSTER=mt1
|
||||||
|
|
||||||
|
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||||
|
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||||
|
|
||||||
|
JWT_SECRET=0d7jvRLDmLglfeW3nDaJaMZUr25aqMiCQA5Vn2Yx8SAfAeDyxC5TgVPS8ig0VlZh
|
||||||
|
|
||||||
|
WECHAT_AUTH_URL=https://seller.daxiangzj.com/bind/index.html
|
||||||
|
WECHAT_TEMPLATE_ID=E6qnsjhXjL5AfGi9l4_l7C9amZWMqko-Gjio6x6HKYk
|
||||||
|
WECHAT_ENCODING_AES_KEY=PbNakT3wNuRd5FiqK0auYJ0lakv1Qka6bRw934fNjOY
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
APP_NAME=Laravel
|
||||||
|
APP_ENV=local
|
||||||
|
APP_KEY=base64:aWVRFh0raBwuGPNNWiCdXZa7lWN8vCEOIE4+dZM0Q64=
|
||||||
|
APP_DEBUG=true
|
||||||
|
APP_URL=http://localhost
|
||||||
|
APP_FILE_URL=https://test.file.daxiangzj.com
|
||||||
|
APP_DOWN_URL=https://test.file.daxiangzj.com
|
||||||
|
LOG_CHANNEL=daily
|
||||||
|
LOG_LEVEL=info
|
||||||
|
|
||||||
|
DB_CONNECTION=mysql
|
||||||
|
DB_HOST=jingcai-mysql-test
|
||||||
|
DB_PORT=3306
|
||||||
|
DB_DATABASE=jingcai
|
||||||
|
DB_USERNAME=jingcai
|
||||||
|
DB_PASSWORD=yLPYX4rWo4n4bwIUGzjM
|
||||||
|
|
||||||
|
BROADCAST_DRIVER=log
|
||||||
|
CACHE_DRIVER=file
|
||||||
|
QUEUE_CONNECTION=sync
|
||||||
|
SESSION_DRIVER=file
|
||||||
|
SESSION_LIFETIME=120
|
||||||
|
|
||||||
|
REDIS_HOST=127.0.0.1
|
||||||
|
REDIS_PASSWORD=null
|
||||||
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
MAIL_MAILER=smtp
|
||||||
|
MAIL_HOST=smtp.mailtrap.io
|
||||||
|
MAIL_PORT=2525
|
||||||
|
MAIL_USERNAME=null
|
||||||
|
MAIL_PASSWORD=null
|
||||||
|
MAIL_ENCRYPTION=null
|
||||||
|
MAIL_FROM_ADDRESS=null
|
||||||
|
MAIL_FROM_NAME="${APP_NAME}"
|
||||||
|
|
||||||
|
AWS_ACCESS_KEY_ID=
|
||||||
|
AWS_SECRET_ACCESS_KEY=
|
||||||
|
AWS_DEFAULT_REGION=us-east-1
|
||||||
|
AWS_BUCKET=
|
||||||
|
|
||||||
|
PUSHER_APP_ID=
|
||||||
|
PUSHER_APP_KEY=
|
||||||
|
PUSHER_APP_SECRET=
|
||||||
|
PUSHER_APP_CLUSTER=mt1
|
||||||
|
|
||||||
|
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||||
|
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||||
|
|
||||||
|
JWT_SECRET=0d7jvRLDmLglfeW3nDaJaMZUr25aqMiCQA5Vn2Yx8SAfAeDyxC5TgVPS8ig0VlZh
|
||||||
|
|
||||||
|
WECHAT_OFFICIAL_APP_ID=wx2bd1e7afd3a70983
|
||||||
|
WECHAT_OFFICIAL_SECRET=a91cc4d77ff9247bdce2cc6316505da4
|
||||||
|
WECHAT_OFFICIAL_TOKEN=LKJ73298KJFDPAlkjf324nkjds
|
||||||
|
WECHAT_OFFICIAL_AES_KEY=
|
||||||
|
|
||||||
|
WECHAT_AUTH_URL=https://test.seller.daxiangzj.com/bind/index.html
|
||||||
|
WECHAT_TEMPLATE_ID=1Dyl6Dio4G50F9iST2LSZq1wDr2L3rKmq7_e5hZpNdc
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
* text=auto
|
||||||
|
*.css linguist-vendored
|
||||||
|
*.scss linguist-vendored
|
||||||
|
*.js linguist-vendored
|
||||||
|
CHANGELOG.md export-ignore
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
/node_modules
|
||||||
|
/public/hot
|
||||||
|
/public/storage
|
||||||
|
/storage/*.key
|
||||||
|
|
||||||
|
/.idea
|
||||||
|
.env
|
||||||
|
.DS_Store
|
||||||
|
.env.backup
|
||||||
|
.phpunit.result.cache
|
||||||
|
mysql/data
|
||||||
|
Homestead.json
|
||||||
|
Homestead.yaml
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
public/uploads/
|
||||||
|
public/pma521
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
php:
|
||||||
|
preset: laravel
|
||||||
|
disabled:
|
||||||
|
- unused_use
|
||||||
|
finder:
|
||||||
|
not-name:
|
||||||
|
- index.php
|
||||||
|
- server.php
|
||||||
|
js:
|
||||||
|
finder:
|
||||||
|
not-name:
|
||||||
|
- webpack.mix.js
|
||||||
|
css: true
|
||||||
|
|
@ -0,0 +1,129 @@
|
||||||
|
HTTPS自签名原因 clone需要加上参数
|
||||||
|
```git -c http.sslVerify=false clone```
|
||||||
|
拉取完修改`.git/config`加入
|
||||||
|
```
|
||||||
|
[http]
|
||||||
|
sslVerify=false
|
||||||
|
```
|
||||||
|
|
||||||
|
### 线上
|
||||||
|
```
|
||||||
|
https://43.137.7.44:9443/#!/2/docker/containers
|
||||||
|
admin
|
||||||
|
KOlYOdJy3uemVgS9Vl3W
|
||||||
|
|
||||||
|
线上数据库 地址 10.206.0.9
|
||||||
|
MYSQL_ROOT_PASSWORD=Q7QrLaIykY5Y0ZHV32yl
|
||||||
|
MYSQL_USER=jingcai
|
||||||
|
MYSQL_PASSWORD=yLPYX4rWo4n4bwIUGzjM
|
||||||
|
MYSQL_DATABASE=jingcai
|
||||||
|
|
||||||
|
彩民: seller.daxiangzj.com
|
||||||
|
店主: buyer.daxiangzj.com
|
||||||
|
前端资源: file.daxiangzj.com
|
||||||
|
|
||||||
|
后端接口:api.yunduoxd.com
|
||||||
|
超管: admin.yunduoxd.com
|
||||||
|
```
|
||||||
|
|
||||||
|
### 支付账号
|
||||||
|
```
|
||||||
|
240019543@qq.com
|
||||||
|
hanbin121748
|
||||||
|
|
||||||
|
证书到期更新指南
|
||||||
|
https://opendocs.alipay.com/common/02kdnh
|
||||||
|
```
|
||||||
|
|
||||||
|
```微信公众号
|
||||||
|
hb@casturing.com
|
||||||
|
Han121748
|
||||||
|
|
||||||
|
|
||||||
|
测试链接
|
||||||
|
https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx2bd1e7afd3a70983&redirect_uri=https%3A%2F%2Ftest.file.daxiangzj.com%2Fapi%2Fseller%2Fwechat%2Fauthorize_base&response_type=code&scope=snsapi_base#wechat_redirect
|
||||||
|
```
|
||||||
|
|
||||||
|
### Apple企业账号
|
||||||
|
``
|
||||||
|
hanbin@pingco.com
|
||||||
|
Zhang121748
|
||||||
|
fastlane自动登录
|
||||||
|
pnyq-fcwy-gemp-pwbq
|
||||||
|
|
||||||
|
签名mobile
|
||||||
|
security cms -S -N
|
||||||
|
``
|
||||||
|
|
||||||
|
### linux
|
||||||
|
``
|
||||||
|
43.137.7.44
|
||||||
|
``
|
||||||
|
|
||||||
|
### 身份证校验
|
||||||
|
```
|
||||||
|
https://www.mca.gov.cn/article/sj/xzqh/1980/ // 民政数据
|
||||||
|
https://github.com/yl/id-card // 身份校验
|
||||||
|
```
|
||||||
|
|
||||||
|
### apidoc
|
||||||
|
```
|
||||||
|
1、npm install -g apidoc
|
||||||
|
|
||||||
|
2、apidoc -i app/Http/Controllers/Api -o public/apidoc
|
||||||
|
```
|
||||||
|
|
||||||
|
### 创建enum
|
||||||
|
```
|
||||||
|
0、php artisan make:enum xxxx
|
||||||
|
1、地址:https://github.com/BenSampo/laravel-enum
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### 彩票规则
|
||||||
|
```
|
||||||
|
https://github.com/Lijianeng10/backend 开源体育
|
||||||
|
每张票上只能50倍
|
||||||
|
|
||||||
|
奖金优化:
|
||||||
|
平均优化:中奖金额 高低差最小
|
||||||
|
博热优化:赔率高的那单最接近本金
|
||||||
|
搏冷优化:赔率低的那单最接近本金
|
||||||
|
|
||||||
|
1、竞彩足球组合:2、4、6 表示有N/2场同时选,同一场胜平负和让球胜平负不能打到一张票上,同一场次同一张票上只能出一种玩法,只要带比分或半全场的最大串数4, 场次最多8场。
|
||||||
|
单场对决:如果只能一场,会自动匹配一场比分在1.8-1.76(后台设置)之间的比赛
|
||||||
|
2、四场,任九和十四场可以串
|
||||||
|
3、6场半全场:每场比赛上和全必选,可以串
|
||||||
|
|
||||||
|
|
||||||
|
大乐透:
|
||||||
|
前5后2
|
||||||
|
胆拖:红蓝必须要有一个胆码
|
||||||
|
|
||||||
|
排列3:
|
||||||
|
组合复式:个十百位组合投注
|
||||||
|
和值:穷举三个数相加
|
||||||
|
组合托单:必须要包含胆码,然后穷举
|
||||||
|
跨度复式:临号和收尾之间差值
|
||||||
|
|
||||||
|
|
||||||
|
比分、进球数、半全场 都可以单关。
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### order fields
|
||||||
|
id,pid,order_sn,customer_id,lottery_id,shop_id,lottery_type_id,type,issue_num,copy_num,bets_num,bets_expect_num,zhu_num,piao_num,money,prize_min,prize_max,pass_mode,play_type,pay_type,pay_state,pay_at,pay_day,odds_close_time,odds_early_close_time,odds_late_close_time,lottery_take_ticket,lottery_state,lottery_prize,lottery_send_prize,lottery_should_send_prize,lottery_tax_prize,lottery_gendan_brokerage,type_mode,type_desc,union_pay_success,union_brokerage,union_brokerage_money,union_keep,union_piece_keep,union_piece_self,union_piece_buy,union_piece_total,union_piece_money,union_money,union_send_prize,union_should_send_prize,gendan_num,odds,odds_raw,revoke_user_id,revoke_at,revoke_message,send_user_id,send_at,send_date,receive_user_id,receive_at,receive_date,draft_user_id,draft_shop_id,draft_at,draft_date,win_date,win_viewed,shop_cooperate_id,cooperate_id,cooperate_show,cooperate_brokerage,cooperate_method,cooperate_common,cooperate_throw_seller_id,created_at,updated_at,deleted_at,created_date
|
||||||
|
|
||||||
|
|
||||||
|
#### 测试信息
|
||||||
|
```测试信息
|
||||||
|
@韩斌 @连红大师 @李贺东 @孙佼 @孙纪科
|
||||||
|
测试环境已部署,以下为更新内容:
|
||||||
|
1、最高奖金
|
||||||
|
2、奖金优化
|
||||||
|
测试地址
|
||||||
|
彩民端:https://test.buyer.daxiangzj.com,账号17011111111,密码111111
|
||||||
|
店主端:https://test.seller.daxiangzj.com,账号17000000000,密码111111
|
||||||
|
```
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 508 KiB |
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"name": "apidoc文档测试",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"description": "apidoc文档测试",
|
||||||
|
"title": "apidoc文档测试",
|
||||||
|
"url": "http://jingcai.local",
|
||||||
|
"sampleUrl": "https://jingcai.quickfly.eu.org:3000",
|
||||||
|
"order": [
|
||||||
|
"Customer",
|
||||||
|
"Seller"
|
||||||
|
],
|
||||||
|
"template": {
|
||||||
|
"forceLanguage": "zh_cn"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use Dcat\Admin\Http\Controllers\AuthController as BaseAuthController;
|
||||||
|
|
||||||
|
class AuthController extends BaseAuthController
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Enums\BoolEnum;
|
||||||
|
use App\Model\Seller\Shop;
|
||||||
|
use App\Model\Seller\ShopPayChannel;
|
||||||
|
use App\Model\Zq\BjdcResult;
|
||||||
|
use App\Utils\Helps;
|
||||||
|
use Dcat\Admin\Admin;
|
||||||
|
use Dcat\Admin\Form;
|
||||||
|
use Dcat\Admin\Grid;
|
||||||
|
|
||||||
|
use Dcat\Admin\Http\Controllers\AdminController;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
|
||||||
|
class BjdcResultController extends AdminController
|
||||||
|
{
|
||||||
|
protected $title = '北京单场SP值';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a grid builder.
|
||||||
|
*
|
||||||
|
* @return Grid
|
||||||
|
*/
|
||||||
|
protected function grid()
|
||||||
|
{
|
||||||
|
return Grid::make(BjdcResult::class, function (Grid $grid) {
|
||||||
|
$grid->model()->with('match')->orderBy('play_num', 'asc');
|
||||||
|
$grid->column('id', 'id');
|
||||||
|
$grid->column('odds_id', 'oddsID');
|
||||||
|
$grid->column('issue_num', '期号');
|
||||||
|
$grid->column('issue_num', '期号');
|
||||||
|
$grid->column('play_num', '场次');
|
||||||
|
$grid->column('match.start_time', '比赛时间');
|
||||||
|
$grid->column('match.home_team_name', '主队');
|
||||||
|
$grid->column('rq_handicap', '让球')->display(function() {
|
||||||
|
if (!$this->rq_handicap) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return Helps::floatFormat($this->rq_handicap);
|
||||||
|
});
|
||||||
|
$grid->column('match.away_team_name', '客队');
|
||||||
|
$grid->column('half_time_score', '半场比分');
|
||||||
|
$grid->column('full_time_score', '常规比分');
|
||||||
|
$grid->column('rq', '让球胜平负')->display(function() {
|
||||||
|
if (!$this->rq_field) {
|
||||||
|
return $this->spf_name . ' -- ' . $this->spf_odds;
|
||||||
|
}
|
||||||
|
return $this->rq_name . ' -R- ' . $this->rq_odds;
|
||||||
|
});
|
||||||
|
$grid->column('jq', '总进球')->display(function() {
|
||||||
|
if (!$this->jq_field) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return $this->jq_name . ' -- ' . $this->jq_odds;
|
||||||
|
});
|
||||||
|
$grid->column('bf', '比分')->display(function() {
|
||||||
|
if (!$this->bf_field) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return $this->bf_name . ' -- ' . $this->bf_odds;
|
||||||
|
});
|
||||||
|
$grid->column('sxpds', '上下单双')->display(function() {
|
||||||
|
if (!$this->sxpds_field) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return $this->sxpds_name . ' -- ' . $this->sxpds_odds;
|
||||||
|
});
|
||||||
|
$grid->column('bqc', '半全场')->display(function() {
|
||||||
|
if (!$this->bqc_field) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return $this->bqc_name . ' -- ' . $this->bqc_odds;
|
||||||
|
});
|
||||||
|
$grid->fixColumns(2);
|
||||||
|
$grid->filter(function ($filter) {
|
||||||
|
$filter->equal('issue_num', '期号');
|
||||||
|
});
|
||||||
|
|
||||||
|
$grid->disableViewButton();
|
||||||
|
$grid->disableEditButton();
|
||||||
|
$grid->disableDeleteButton();
|
||||||
|
$grid->scrollbarX();//数据展开
|
||||||
|
$grid->disableCreateButton();
|
||||||
|
$grid->disableRowSelector();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
trait ControllerTrait
|
||||||
|
{
|
||||||
|
|
||||||
|
public function jsonSuccess($data = [], $message = '') {
|
||||||
|
return [
|
||||||
|
'code' => 200,
|
||||||
|
'message' => $message,
|
||||||
|
'data' => $data
|
||||||
|
];
|
||||||
|
}
|
||||||
|
public function jsonFail($message, $code = 1000) {
|
||||||
|
return [
|
||||||
|
'code' => $code,
|
||||||
|
'message' => $message,
|
||||||
|
'data' => []
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,83 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Admin\Forms\CustomerPasswordForm;
|
||||||
|
use App\Enums\BoolEnum;
|
||||||
|
use App\Model\Customer\Customer;
|
||||||
|
use Dcat\Admin\Grid;
|
||||||
|
use App\Model\Seller\Shop;
|
||||||
|
|
||||||
|
use Dcat\Admin\Http\Controllers\AdminController;
|
||||||
|
|
||||||
|
|
||||||
|
class CustomerController extends AdminController
|
||||||
|
{
|
||||||
|
protected $title='彩民管理';
|
||||||
|
/**
|
||||||
|
* Make a grid builder.
|
||||||
|
*
|
||||||
|
* @return Grid
|
||||||
|
*/
|
||||||
|
protected function grid()
|
||||||
|
{
|
||||||
|
return Grid::make(Customer::class, function (Grid $grid) {
|
||||||
|
$grid->model()->with('shop')->orderBy('id', 'desc');
|
||||||
|
|
||||||
|
$grid->column('id','ID');
|
||||||
|
|
||||||
|
$grid->column('shop.shop_sn','店铺编号');
|
||||||
|
$grid->column('shop.name','店铺名称');
|
||||||
|
$grid->column('phone','手机号');
|
||||||
|
$grid->column('name','真实名称');
|
||||||
|
$grid->column('nickname','昵称');
|
||||||
|
$grid->column('remark','店主备注');
|
||||||
|
$grid->column('agent','是否代理用户')->display(function() {
|
||||||
|
if ($this->agent == BoolEnum::YES) {
|
||||||
|
return '是';
|
||||||
|
}
|
||||||
|
return '否';
|
||||||
|
});
|
||||||
|
$grid->column('agent_brokerage','代理佣金');
|
||||||
|
$grid->column('balance','总余额')->help('可提现余额+不可提现余额+冻结余额');
|
||||||
|
$grid->column('balance_withdraw','可提现余额');
|
||||||
|
$grid->column('balance_cash','不可提现余额');
|
||||||
|
$grid->column('balance_freeze','冻结余额');
|
||||||
|
$grid->column('pd','修改(支付)密码')->modal(function (Grid\Displayers\Modal $modal){
|
||||||
|
|
||||||
|
// 标题
|
||||||
|
$modal->title('修改(支付)密码');
|
||||||
|
// 自定义图标
|
||||||
|
$modal->icon('feather icon-edit');
|
||||||
|
// 传递当前行字段值
|
||||||
|
return CustomerPasswordForm::make()->payload(['id' => $this->id]);
|
||||||
|
});
|
||||||
|
$grid->column('balance_freeze','冻结余额');
|
||||||
|
$grid->column('created_at','创建时间');
|
||||||
|
$grid->filter(function($filter){
|
||||||
|
$shops = Shop::pluck('name','id')->toArray();
|
||||||
|
$shopsn = Shop::pluck('shop_sn')->toArray();
|
||||||
|
|
||||||
|
$shopsns = [];
|
||||||
|
foreach ($shopsn as $s) {
|
||||||
|
$shopsns[$s] = $s;
|
||||||
|
}
|
||||||
|
|
||||||
|
$filter->equal('shop.id', '店铺')->select($shops);
|
||||||
|
$filter->equal('shop.shop_sn', '店铺编号')->select($shopsns);
|
||||||
|
|
||||||
|
$filter->panel();
|
||||||
|
$filter->like('name','用户名');
|
||||||
|
$filter->like('nickname','真实名称');
|
||||||
|
$filter->like('phone','手机号');
|
||||||
|
});
|
||||||
|
|
||||||
|
$grid->disableViewButton();
|
||||||
|
$grid->disableEditButton();
|
||||||
|
$grid->disableDeleteButton();
|
||||||
|
$grid->scrollbarX();//数据展开
|
||||||
|
$grid->disableActions();
|
||||||
|
$grid->disableRowSelector();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,145 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Admin\Forms\SendPrizeDltForm;
|
||||||
|
use App\Admin\Forms\SendPrizePlsForm;
|
||||||
|
use App\Admin\Forms\SendPrizePlwForm;
|
||||||
|
use App\Admin\Forms\SendPrizeQxcForm;
|
||||||
|
use App\Enums\BoolEnum;
|
||||||
|
use App\Model\Dlt;
|
||||||
|
use App\Model\Pls;
|
||||||
|
use App\Model\Plw;
|
||||||
|
use App\Model\Qxc;
|
||||||
|
use App\Model\Seller\Shop;
|
||||||
|
use App\Model\Seller\ShopPayChannel;
|
||||||
|
use App\Model\Zq\BjdcResult;
|
||||||
|
use App\Utils\Helps;
|
||||||
|
use Dcat\Admin\Admin;
|
||||||
|
use Dcat\Admin\Form;
|
||||||
|
use Dcat\Admin\Grid;
|
||||||
|
|
||||||
|
use Dcat\Admin\Http\Controllers\AdminController;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
|
||||||
|
class DltController extends AdminController
|
||||||
|
{
|
||||||
|
protected $title = '大乐透';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a grid builder.
|
||||||
|
*
|
||||||
|
* @return Grid
|
||||||
|
*/
|
||||||
|
protected function grid()
|
||||||
|
{
|
||||||
|
return Grid::make(Dlt::class, function (Grid $grid) {
|
||||||
|
$grid->model()->orderBy('issue_num', 'desc');
|
||||||
|
$grid->column('id', 'id');
|
||||||
|
$grid->column('issue_num', '期号');
|
||||||
|
$grid->column('state', '是否开奖')->display(function () {
|
||||||
|
if ($this->state == BoolEnum::YES) {
|
||||||
|
return '是';
|
||||||
|
}
|
||||||
|
if ($this->state == BoolEnum::NO) {
|
||||||
|
return '否';
|
||||||
|
}
|
||||||
|
return '-';
|
||||||
|
});
|
||||||
|
$grid->column('enable', '销售中')->display(function () {
|
||||||
|
if ($this->enable == BoolEnum::YES) {
|
||||||
|
return '是';
|
||||||
|
}
|
||||||
|
if ($this->enable == BoolEnum::NO) {
|
||||||
|
return '否';
|
||||||
|
}
|
||||||
|
return '-';
|
||||||
|
});
|
||||||
|
$grid->column('close_time', '停售时间');
|
||||||
|
$grid->column('prize_time', '开奖时间');
|
||||||
|
$grid->column('qian', '红')->display(function () {
|
||||||
|
return $this->qian ? implode(',', $this->qian) : '';
|
||||||
|
});
|
||||||
|
$grid->column('hou', '蓝')->display(function () {
|
||||||
|
return $this->hou ? implode(',', $this->hou) : '';
|
||||||
|
});
|
||||||
|
$grid->column('prize', '奖池');
|
||||||
|
$grid->column('base1_prize', '一等奖');
|
||||||
|
$grid->column('base2_prize', '二等奖');
|
||||||
|
$grid->column('base3_prize', '三等奖');
|
||||||
|
$grid->column('add1_prize', '一等奖追加');
|
||||||
|
$grid->column('add2_prize', '二等奖追加');
|
||||||
|
$grid->column('add3_prize', '三等奖追加');
|
||||||
|
$grid->column('__','派奖')
|
||||||
|
->modal(function (Grid\Displayers\Modal $modal){
|
||||||
|
|
||||||
|
// 标题
|
||||||
|
$modal->title('大乐透派奖');
|
||||||
|
// 自定义图标
|
||||||
|
$modal->icon('feather icon-navigation');
|
||||||
|
// 传递当前行字段值
|
||||||
|
return SendPrizeDltForm::make()->payload(['id' => $this->id]);
|
||||||
|
})->help('派奖谨慎操作');
|
||||||
|
$grid->fixColumns(2);
|
||||||
|
$grid->filter(function ($filter) {
|
||||||
|
$filter->equal('issue_num', '期号');
|
||||||
|
});
|
||||||
|
$grid->disableViewButton();
|
||||||
|
$grid->disableDeleteButton();
|
||||||
|
$grid->scrollbarX();//数据展开
|
||||||
|
$grid->disableRowSelector();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function form()
|
||||||
|
{
|
||||||
|
return Form::make(new Dlt(), function (Form $form) {
|
||||||
|
|
||||||
|
$form->text('issue_num', '期号')->required();
|
||||||
|
$form->select('state', '是否开奖')->options(BoolEnum::asSelectArray())->required();
|
||||||
|
$form->select('enable', '销售中')->options(BoolEnum::asSelectArray())->required();
|
||||||
|
$form->datetime('close_time', '停售时间');
|
||||||
|
$form->datetime('prize_time', '开奖时间');
|
||||||
|
if ($form->model()->qian && is_string($form->model()->qian)) {
|
||||||
|
$form->model()->qian = json_decode($form->model()->qian, true);
|
||||||
|
}
|
||||||
|
if ($form->model()->hou && is_string($form->model()->hou)) {
|
||||||
|
$form->model()->hou = json_decode($form->model()->hou, true);
|
||||||
|
}
|
||||||
|
$form->model()->qian = is_array($form->model()->qian) ? implode(',', $form->model()->qian) : $form->model()->qian;
|
||||||
|
$form->model()->hou = is_array($form->model()->hou) ? implode(',', $form->model()->hou) : $form->model()->hou;
|
||||||
|
$form->text('qian', '红')->help('以,分割,顺序一定要对');
|
||||||
|
$form->text('hou', '蓝')->help('以,分割,顺序一定要对');
|
||||||
|
$form->text('prize', '奖池')->default('');
|
||||||
|
$form->decimal('base1_prize', '一等奖')->default(0);
|
||||||
|
$form->decimal('base2_prize', '二等奖')->default(0);
|
||||||
|
$form->decimal('base3_prize', '三等奖')->default(0);
|
||||||
|
$form->decimal('add1_prize', '一等奖追加')->default(0);
|
||||||
|
$form->decimal('add2_prize', '二等奖追加')->default(0);
|
||||||
|
$form->decimal('add3_prize', '三等奖追加')->default(0);
|
||||||
|
$form->divider();
|
||||||
|
$form->saving(function ($form) {
|
||||||
|
if ($form->qian) {
|
||||||
|
$form->qian = explode(',', $form->qian);
|
||||||
|
} else {
|
||||||
|
$form->qian = '';
|
||||||
|
}
|
||||||
|
if ($form->hou) {
|
||||||
|
$form->hou = explode(',', $form->hou);
|
||||||
|
} else {
|
||||||
|
$form->hou = '';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$form->footer(function ($footer) {
|
||||||
|
// 去掉`查看`checkbox
|
||||||
|
$footer->disableViewCheck();
|
||||||
|
// 去掉`继续编辑`checkbox
|
||||||
|
$footer->disableEditingCheck();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Admin\Metrics\Examples;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Dcat\Admin\Http\Controllers\Dashboard;
|
||||||
|
use Dcat\Admin\Layout\Column;
|
||||||
|
use Dcat\Admin\Layout\Content;
|
||||||
|
use Dcat\Admin\Layout\Row;
|
||||||
|
|
||||||
|
class HomeController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Content $content)
|
||||||
|
{
|
||||||
|
|
||||||
|
return $content
|
||||||
|
->header('欢迎登陆')
|
||||||
|
->description('今天是'.date('Y-m-d'))
|
||||||
|
->body(function (Row $row) {
|
||||||
|
// $row->column(6, function (Column $column) {
|
||||||
|
// $column->row(Dashboard::title());
|
||||||
|
// $column->row(new Examples\Tickets());
|
||||||
|
// });
|
||||||
|
|
||||||
|
// $row->column(6, function (Column $column) {
|
||||||
|
// $column->row(function (Row $row) {
|
||||||
|
// $row->column(6, new Examples\NewUsers());
|
||||||
|
// $row->column(6, new Examples\NewDevices());
|
||||||
|
// });
|
||||||
|
|
||||||
|
// $column->row(new Examples\Sessions());
|
||||||
|
// $column->row(new Examples\ProductOrders());
|
||||||
|
// });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Enums\BoolEnum;
|
||||||
|
use Dcat\Admin\Grid;
|
||||||
|
use Dcat\Admin\Form;
|
||||||
|
use App\Model\Auth\AdminModel;
|
||||||
|
use App\Model\Auth\RoleModel;
|
||||||
|
use App\Model\LotteryType;
|
||||||
|
|
||||||
|
use Dcat\Admin\Http\Controllers\AdminController;
|
||||||
|
|
||||||
|
|
||||||
|
class LotteryTypeController extends AdminController
|
||||||
|
{
|
||||||
|
protected $title='彩种管理';
|
||||||
|
/**
|
||||||
|
* Make a grid builder.
|
||||||
|
*
|
||||||
|
* @return Grid
|
||||||
|
*/
|
||||||
|
protected function grid()
|
||||||
|
{
|
||||||
|
return Grid::make(LotteryType::class, function (Grid $grid) {
|
||||||
|
$grid->model()->orderBy('id', 'desc');
|
||||||
|
|
||||||
|
$grid->column('id','彩种ID');
|
||||||
|
$grid->column('name','彩种名称');
|
||||||
|
$grid->column('type','彩种标识');
|
||||||
|
// $grid->column('status','彩种状态')->using(LotteryType::LOTTERYTYPE_STATUS)->label([
|
||||||
|
// 'default' => 'red', // 设置默认颜色,不设置则默认为 default
|
||||||
|
// 1 => 'blue'
|
||||||
|
// ]);
|
||||||
|
// 或者
|
||||||
|
// $grid->status('彩种状态')->switch();
|
||||||
|
$grid->column('status','彩种状态')->switch('', true);
|
||||||
|
|
||||||
|
$grid->column('info','彩种标语');
|
||||||
|
|
||||||
|
$grid->column('created_at','创建时间');
|
||||||
|
$grid->filter(function($filter){
|
||||||
|
$filter->panel();
|
||||||
|
$filter->equal('status','彩种状态')->select(LotteryType::LOTTERYTYPE_STATUS);
|
||||||
|
$filter->like('name','彩种名称');
|
||||||
|
});
|
||||||
|
|
||||||
|
$grid->disableViewButton();
|
||||||
|
// $grid->disableEditButton();
|
||||||
|
$grid->disableDeleteButton();
|
||||||
|
$grid->scrollbarX();//数据展开
|
||||||
|
// $grid->disableActions();
|
||||||
|
// $grid->disableRowSelector();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function form()
|
||||||
|
{
|
||||||
|
return Form::make(new LotteryType(), function (Form $form) {
|
||||||
|
|
||||||
|
$form->text('name','彩种名称')->required();
|
||||||
|
$form->text('type','彩种标识')->required();
|
||||||
|
|
||||||
|
$form->radio('status','彩种状态')->options(LotteryType::LOTTERYTYPE_STATUS)->required();
|
||||||
|
$form->divider();
|
||||||
|
|
||||||
|
$form->footer(function($footer) {
|
||||||
|
// 去掉`查看`checkbox
|
||||||
|
$footer->disableViewCheck();
|
||||||
|
// 去掉`继续编辑`checkbox
|
||||||
|
$footer->disableEditingCheck();
|
||||||
|
});
|
||||||
|
$form->disableDeleteButton();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,322 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Admin\Forms\OrderCancelForm;
|
||||||
|
use App\Admin\Forms\ShopBalanceForm;
|
||||||
|
use App\Enums\FadanType;
|
||||||
|
use App\Enums\LottState;
|
||||||
|
use App\Enums\LottType;
|
||||||
|
use App\Enums\OptimizeType;
|
||||||
|
|
||||||
|
use App\Enums\OrderType;
|
||||||
|
use App\Enums\PayState;
|
||||||
|
use App\Enums\SellerLevel;
|
||||||
|
use App\Model\Customer\Customer;
|
||||||
|
use App\Model\Lottery;
|
||||||
|
use App\Model\LotteryType;
|
||||||
|
use App\Model\Order;
|
||||||
|
use App\Model\Seller\Seller;
|
||||||
|
use App\Model\Zq\JczqOdds;
|
||||||
|
use App\Model\Zq\JczqResult;
|
||||||
|
use App\Service\JczqService;
|
||||||
|
use App\Utils\Helps;
|
||||||
|
use Dcat\Admin\Admin;
|
||||||
|
use Dcat\Admin\Grid;
|
||||||
|
use Dcat\Admin\Form;
|
||||||
|
use App\Model\Seller\Shop;
|
||||||
|
use App\Model\ShopAgent;
|
||||||
|
|
||||||
|
use App\Admin\Forms\ShopAgentForm;
|
||||||
|
|
||||||
|
use Dcat\Admin\Http\Controllers\AdminController;
|
||||||
|
use Dcat\Admin\Layout\Content;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
|
|
||||||
|
|
||||||
|
class OrderController extends AdminController
|
||||||
|
{
|
||||||
|
use ControllerTrait;
|
||||||
|
protected $title = '订单管理';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a grid builder.
|
||||||
|
*
|
||||||
|
* @return Grid
|
||||||
|
*/
|
||||||
|
protected function grid()
|
||||||
|
{
|
||||||
|
return Grid::make(Order::class, function (Grid $grid) {
|
||||||
|
$grid->model()->with([
|
||||||
|
'materials:id,order_id,path',
|
||||||
|
'lotteryType:id,type,name',
|
||||||
|
'customer:id,nickname,name,avatar,phone',
|
||||||
|
'receiver:id,nickname,name,shop_id',
|
||||||
|
'receiver.shop:id,name,shop_sn',
|
||||||
|
'shop:id,agent_seller_id',
|
||||||
|
'shop.agentSeller:id,name,nickname',
|
||||||
|
])->orderBy('id', 'desc');
|
||||||
|
|
||||||
|
$grid->column('id', '订单ID');
|
||||||
|
$grid->column('order_sn', '订单编号')->modal(function (Grid\Displayers\Modal $modal){
|
||||||
|
|
||||||
|
// 标题
|
||||||
|
$modal->title('取消订单');
|
||||||
|
// 自定义图标
|
||||||
|
$modal->icon('feather icon-edit');
|
||||||
|
// 传递当前行字段值
|
||||||
|
return OrderCancelForm::make()->payload(['id' => $this->id]);
|
||||||
|
});
|
||||||
|
$grid->column('fadan_type', '发单类型')->display(function() {
|
||||||
|
if ($this->type != OrderType::FADAN) {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return FadanType::getDescription($this->fadan_type);
|
||||||
|
});
|
||||||
|
|
||||||
|
$grid->column('money1', '订单金额')->display(function () {
|
||||||
|
|
||||||
|
return $this->getPayMoney();
|
||||||
|
});
|
||||||
|
$grid->column('status', '订单状态')->display(function () {
|
||||||
|
return LottState::getDescription($this->lottery_state);
|
||||||
|
});
|
||||||
|
$grid->column('piao', '票据')->display(function ($pictures) {
|
||||||
|
$arr = $this->materials->toArray();
|
||||||
|
return array_column($arr, 'path');
|
||||||
|
})->image(env('APP_FILE_URL'), 100, 100);
|
||||||
|
|
||||||
|
$grid->column('customer.nickname', '彩民');
|
||||||
|
$grid->column('optimize_type', '奖金优化')->display(function () {
|
||||||
|
return OptimizeType::getDescription($this->optimize_type);
|
||||||
|
});
|
||||||
|
|
||||||
|
$grid->column('customer.phone', '彩民手机号');
|
||||||
|
|
||||||
|
$grid->column('shop.agentSeller.id', '代理人')->display(function() {
|
||||||
|
return $this->shop->agentSeller ? $this->shop->agentSeller->nickname : '-';
|
||||||
|
});
|
||||||
|
$grid->column('receiver.nickname', '接单人');
|
||||||
|
$grid->column('receiver.shop.name', '接单店铺名');
|
||||||
|
$grid->column('receiver.shop.shop_sn', '接单店铺编号');
|
||||||
|
|
||||||
|
$grid->column('created_at', '创建时间');
|
||||||
|
$grid->fixColumns(-2);
|
||||||
|
$grid->filter(function ($filter) {
|
||||||
|
$agentSellers = Seller::where('level', SellerLevel::MASTER)->pluck('nickname', 'id');
|
||||||
|
$filter->panel();
|
||||||
|
$filter->like('order_sn', '订单编号');
|
||||||
|
$filter->equal('draft_shop_id', '出票店铺编号')->select(Shop::pluck('shop_sn', 'id'));
|
||||||
|
$agentSellers = Seller::where('level', SellerLevel::MASTER)->pluck('nickname', 'id');
|
||||||
|
$filter->equal('shop.agentSeller.id', '代理人')->select($agentSellers);
|
||||||
|
$filter->equal('fadan_type', '发单类型')->select(FadanType::typeAsArray());
|
||||||
|
$filter->between('created_at', '创建时间')->datetime();
|
||||||
|
});
|
||||||
|
|
||||||
|
$grid->disableViewButton();
|
||||||
|
$grid->disableEditButton();
|
||||||
|
$grid->disableDeleteButton();
|
||||||
|
$grid->scrollbarX();//数据展开
|
||||||
|
// $grid->disableActions();
|
||||||
|
// $grid->disableRowSelector();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function form()
|
||||||
|
{
|
||||||
|
return Form::make(new Order(), function (Form $form) {
|
||||||
|
|
||||||
|
$form->divider();
|
||||||
|
$form->saving(function ($form) {
|
||||||
|
|
||||||
|
});
|
||||||
|
$form->footer(function ($footer) {
|
||||||
|
// 去掉`查看`checkbox
|
||||||
|
$footer->disableViewCheck();
|
||||||
|
// 去掉`继续编辑`checkbox
|
||||||
|
$footer->disableEditingCheck();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function shopOrderMoney(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
$month = $request->input('month');
|
||||||
|
$start = $request->input('start');
|
||||||
|
$end = $request->input('end');
|
||||||
|
|
||||||
|
if ($month) {
|
||||||
|
$start = $month . '01';
|
||||||
|
$end = $month . '31';
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT b.agent_seller_id,c.real_name,a.shop_id,b.name,sum(money) as c FROM `order` as a left join shop as b on a.shop_id=b.id LEFT JOIN seller as c on b.agent_seller_id=c.id where a.lottery_state in (1,2,3,7) and a.created_date>='{$start}' and a.created_date<='{$end}' and ((a.type =3 and a.pid=a.id) or a.type!=3) group by a.shop_id order by c desc;";
|
||||||
|
|
||||||
|
$data = DB::select($sql);
|
||||||
|
$excel = new Spreadsheet();
|
||||||
|
$sheet = $excel->getActiveSheet();
|
||||||
|
$sheet->setCellValue('A1','代理人ID');
|
||||||
|
$sheet->setCellValue('B1','代理人名称');
|
||||||
|
$sheet->setCellValue('C1','店铺ID');
|
||||||
|
$sheet->setCellValue('D1','店铺名称');
|
||||||
|
$sheet->setCellValue('E1','出单流水');
|
||||||
|
|
||||||
|
$i = 2;
|
||||||
|
foreach ($data as $item) {
|
||||||
|
$sheet->setCellValueByColumnAndRow(1, $i, $item->agent_seller_id);
|
||||||
|
$sheet->setCellValueByColumnAndRow(2, $i, $item->real_name);
|
||||||
|
$sheet->setCellValueByColumnAndRow(3, $i, $item->shop_id);
|
||||||
|
$sheet->setCellValueByColumnAndRow(4, $i, $item->name);
|
||||||
|
$sheet->setCellValueByColumnAndRow(5, $i, Helps::floatFormat($item->c));
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置响应头,告诉浏览器文件类型
|
||||||
|
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||||
|
header('Content-Disposition: attachment;filename="'.sprintf('%s-%s', $start, $end).'店铺流水.xlsx"');
|
||||||
|
header('Cache-Control: max-age=0');
|
||||||
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($excel, 'Xlsx');
|
||||||
|
$writer->save('php://output');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function autoFadan(Request $request, Content $content) {
|
||||||
|
$lianHong = $request->input('lian_hong', 3);
|
||||||
|
$chuanNum = $request->input('chuan_num', 2);
|
||||||
|
$moneyRateMin = $request->input('money_rate_min', 1.6);
|
||||||
|
$moneyRateMax = $request->input('money_rate_max', 7);
|
||||||
|
$customerId = $request->input('customer_id', 0);
|
||||||
|
$betsNum = $request->input('bets_num', 1); // 倍数
|
||||||
|
|
||||||
|
$customer = null;
|
||||||
|
if ($customerId) {
|
||||||
|
$customer = Customer::find($customerId);
|
||||||
|
if (!$customer) {
|
||||||
|
return $this->jsonFail('彩民不存在');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$i = 1;
|
||||||
|
$orders = [];
|
||||||
|
while ($i < $lianHong) {
|
||||||
|
if (!$customer) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (count($orders) >= $lianHong) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$date = date('Y-m-d', strtotime("-{$i} day"));
|
||||||
|
$i++;
|
||||||
|
/** @var JczqResult $result */
|
||||||
|
$result = JczqResult::where('issue_date', $date)
|
||||||
|
->orderBy(DB::raw('RAND()'))
|
||||||
|
->first();
|
||||||
|
if (!$result) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$errors = [];
|
||||||
|
try {
|
||||||
|
$odds = JczqResult::getAutoOrderOdds($date, $chuanNum, $moneyRateMin, $moneyRateMax);
|
||||||
|
$order = $this->createAutoOrder($customer, $odds, $betsNum, $chuanNum);
|
||||||
|
if ($order) {
|
||||||
|
$orders[] = $order;
|
||||||
|
}
|
||||||
|
} catch (\Exception $exception) {
|
||||||
|
$errors[] = $exception->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$customers = Customer::pluck('nickname', 'id')->toArray();
|
||||||
|
return $content->title('后台发单')
|
||||||
|
->body(view('admin.auto_fadan', [
|
||||||
|
'lian_hong' => $lianHong,
|
||||||
|
'chuan_num' => $chuanNum,
|
||||||
|
'money_rate_min' => $moneyRateMin,
|
||||||
|
'money_rate_max' => $moneyRateMax,
|
||||||
|
'customer_id' => $customerId,
|
||||||
|
'bets_num' => $betsNum,
|
||||||
|
'orders' => $orders,
|
||||||
|
'customers' => $customers,
|
||||||
|
]));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createAutoOrder(Customer $customer,$odds, $betsNum, $chuan) {
|
||||||
|
$passMode = [$chuan . '.1'];
|
||||||
|
/** @var JczqService $service */
|
||||||
|
$service = app((JczqService::class));
|
||||||
|
|
||||||
|
$prizeInfo = $service->computePrizeInfo($odds, $betsNum, $passMode);
|
||||||
|
$jczqOdds = JczqOdds::whereIn('id', array_keys($odds))->get();
|
||||||
|
$lotterType = LotteryType::where('type', LottType::JCZQ)->first();
|
||||||
|
$lottery = Lottery::where('shop_id', $customer->shop_id)
|
||||||
|
->where('lottery_type_id', $lotterType->id)
|
||||||
|
->first();
|
||||||
|
$closeTimes = [];
|
||||||
|
$oddsCloseTimes = [];
|
||||||
|
foreach ($jczqOdds as $match) {
|
||||||
|
$realCloseTime = strtotime($match->real_close_time) - $lottery->earlySecond();
|
||||||
|
$real_close_time = date('Y-m-d H:i:s', $realCloseTime);
|
||||||
|
$closeTimes[] = $real_close_time;
|
||||||
|
$oddsCloseTimes[] = $match->real_close_time;
|
||||||
|
}
|
||||||
|
sort($closeTimes);
|
||||||
|
sort($oddsCloseTimes);
|
||||||
|
$earlyTime = $closeTimes[0];
|
||||||
|
$oddsCloseTime = $oddsCloseTimes[0];
|
||||||
|
$lateTime = $closeTimes[count($closeTimes) - 1];
|
||||||
|
|
||||||
|
$prize = $prizeInfo['prize_max'];
|
||||||
|
if ($prize <= 0) {
|
||||||
|
Log::error('backend createAutoOrder error, prize is 0', [
|
||||||
|
'odds' => $odds,
|
||||||
|
'prize' => $prizeInfo
|
||||||
|
]);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$money = $betsNum * 2;
|
||||||
|
$order = new Order();
|
||||||
|
$order->pid = 0;
|
||||||
|
$order->customer_id = $customer->id;
|
||||||
|
$order->lottery_id = $lottery->id;
|
||||||
|
$order->shop_id = $customer->shop_id;
|
||||||
|
$order->lottery_type_id = $lotterType->id;
|
||||||
|
$order->order_sn = Order::makeOrderSn();
|
||||||
|
$order->play_type = 'mixed';
|
||||||
|
$order->bets_num = $betsNum;
|
||||||
|
$order->bets_expect_num = $prize / $money;
|
||||||
|
$order->zhu_num = 1;
|
||||||
|
$order->piao_num = 1;
|
||||||
|
$order->money = $money;
|
||||||
|
$order->prize_min = $prize;
|
||||||
|
$order->prize_max = $prize;
|
||||||
|
$order->pay_state = PayState::SUCCESS;
|
||||||
|
$order->pass_mode = $passMode;
|
||||||
|
$order->odds_close_time = $oddsCloseTime;
|
||||||
|
$order->odds_early_close_time = $earlyTime;
|
||||||
|
$order->odds_late_close_time = $lateTime;
|
||||||
|
$order->type = OrderType::FADAN;
|
||||||
|
$order->type_mode = 3;
|
||||||
|
$order->type_desc = '快来跟我一起中大奖吧!';
|
||||||
|
$order->odds = $odds;
|
||||||
|
$order->optimize_type = 0;
|
||||||
|
$order->fadan_type = FadanType::SYSTEM;
|
||||||
|
$order->created_date = date('Ymd');
|
||||||
|
$order->lottery_state = LottState::SEND;
|
||||||
|
$order->lottery_prize = $prize;
|
||||||
|
$order->lottery_send_prize = $prize;
|
||||||
|
$order->lottery_should_send_prize = $prize;
|
||||||
|
$order->lottery_tax_prize = $prize;
|
||||||
|
$hour = rand(2,10);
|
||||||
|
$order->created_at = date('Y-m-d H:i:s', strtotime($earlyTime) - $hour);
|
||||||
|
$order->updated_at = date('Y-m-d H:i:s', strtotime($earlyTime) - $hour);
|
||||||
|
$order->save();
|
||||||
|
return $order;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,124 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Admin\Forms\SendPrizePlsForm;
|
||||||
|
use App\Enums\BoolEnum;
|
||||||
|
use App\Model\Pls;
|
||||||
|
use Dcat\Admin\Form;
|
||||||
|
use Dcat\Admin\Grid;
|
||||||
|
|
||||||
|
use Dcat\Admin\Http\Controllers\AdminController;
|
||||||
|
|
||||||
|
|
||||||
|
class PlsController extends AdminController
|
||||||
|
{
|
||||||
|
protected $title = '排列三';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a grid builder.
|
||||||
|
*
|
||||||
|
* @return Grid
|
||||||
|
*/
|
||||||
|
protected function grid()
|
||||||
|
{
|
||||||
|
return Grid::make(Pls::class, function (Grid $grid) {
|
||||||
|
$grid->model()->orderBy('issue_num', 'desc');
|
||||||
|
$grid->column('id', 'id');
|
||||||
|
$grid->column('issue_num', '期号');
|
||||||
|
$grid->column('state', '是否开奖')->display(function () {
|
||||||
|
if ($this->state == BoolEnum::YES) {
|
||||||
|
return '是';
|
||||||
|
}
|
||||||
|
if ($this->state == BoolEnum::NO) {
|
||||||
|
return '否';
|
||||||
|
}
|
||||||
|
return '-';
|
||||||
|
});
|
||||||
|
$grid->column('enable', '销售中')->display(function () {
|
||||||
|
if ($this->enable == BoolEnum::YES) {
|
||||||
|
return '是';
|
||||||
|
}
|
||||||
|
if ($this->enable == BoolEnum::NO) {
|
||||||
|
return '否';
|
||||||
|
}
|
||||||
|
return '-';
|
||||||
|
});
|
||||||
|
|
||||||
|
$grid->column('close_time', '停售时间');
|
||||||
|
$grid->column('prize_time', '开奖时间');
|
||||||
|
$grid->column('result', '结果')->display(function () {
|
||||||
|
return $this->result ? implode(',', $this->result) : '';
|
||||||
|
});
|
||||||
|
$grid->column('prize', '奖池');
|
||||||
|
$grid->column('zhixuan_prize', '直选奖金');
|
||||||
|
$grid->column('zuxuan3_prize', '组3奖金');
|
||||||
|
$grid->column('zuxuan6_prize', '组6奖金');
|
||||||
|
$grid->column('daxiao', '大小');
|
||||||
|
$grid->column('jiou', '奇偶');
|
||||||
|
$grid->column('zhihe', '质合');
|
||||||
|
$grid->column('hezhi', '和值');
|
||||||
|
$grid->column('kuadu', '跨度');
|
||||||
|
$grid->column('__','派奖')
|
||||||
|
->modal(function (Grid\Displayers\Modal $modal){
|
||||||
|
|
||||||
|
// 标题
|
||||||
|
$modal->title('排列三派奖');
|
||||||
|
// 自定义图标
|
||||||
|
$modal->icon('feather icon-navigation');
|
||||||
|
// 传递当前行字段值
|
||||||
|
return SendPrizePlsForm::make()->payload(['id' => $this->id]);
|
||||||
|
})->help('派奖谨慎操作');
|
||||||
|
$grid->fixColumns(2);
|
||||||
|
$grid->filter(function ($filter) {
|
||||||
|
$filter->equal('issue_num', '期号');
|
||||||
|
});
|
||||||
|
$grid->disableViewButton();
|
||||||
|
$grid->disableDeleteButton();
|
||||||
|
$grid->scrollbarX();//数据展开
|
||||||
|
$grid->disableRowSelector();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function form()
|
||||||
|
{
|
||||||
|
return Form::make(new Pls(), function (Form $form) {
|
||||||
|
$form->text('issue_num', '期号')->required();
|
||||||
|
$form->select('state', '是否开奖')->options(BoolEnum::asSelectArray())->required();
|
||||||
|
$form->select('enable', '销售中')->options(BoolEnum::asSelectArray())->required();
|
||||||
|
$form->datetime('close_time', '停售时间');
|
||||||
|
$form->datetime('prize_time', '开奖时间');
|
||||||
|
if ($form->model()->result && is_string($form->model()->result)) {
|
||||||
|
$form->model()->result = json_decode($form->model()->result, true);
|
||||||
|
}
|
||||||
|
$form->model()->result = is_array($form->model()->result) ? implode(',', $form->model()->result) : $form->model()->result;
|
||||||
|
$form->text('result', '结果')->help('以,分割,顺序一定要对');
|
||||||
|
$form->decimal('prize', '奖池')->default(0);
|
||||||
|
$form->decimal('zhixuan_prize', '直选奖金')->default(1040);
|
||||||
|
$form->decimal('zuxuan3_prize', '组3奖金')->default(346);
|
||||||
|
$form->decimal('zuxuan6_prize', '组6奖金')->default(173);
|
||||||
|
$form->text('daxiao', '大小')->default('');
|
||||||
|
$form->text('jiou', '奇偶')->default('');
|
||||||
|
$form->text('zhihe', '质合')->default('');
|
||||||
|
$form->number('hezhi', '和值')->default(0);
|
||||||
|
$form->number('kuadu', '跨度')->default(0);
|
||||||
|
$form->divider();
|
||||||
|
$form->saving(function ($form) {
|
||||||
|
if ($form->result) {
|
||||||
|
$form->result = explode(',', $form->result);
|
||||||
|
} else {
|
||||||
|
$form->result = '';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$form->footer(function ($footer) {
|
||||||
|
// 去掉`查看`checkbox
|
||||||
|
$footer->disableViewCheck();
|
||||||
|
// 去掉`继续编辑`checkbox
|
||||||
|
$footer->disableEditingCheck();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,115 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Admin\Forms\SendPrizePlsForm;
|
||||||
|
use App\Admin\Forms\SendPrizePlwForm;
|
||||||
|
use App\Enums\BoolEnum;
|
||||||
|
use App\Model\Pls;
|
||||||
|
use App\Model\Plw;
|
||||||
|
use App\Model\Seller\Shop;
|
||||||
|
use App\Model\Seller\ShopPayChannel;
|
||||||
|
use App\Model\Zq\BjdcResult;
|
||||||
|
use App\Utils\Helps;
|
||||||
|
use Dcat\Admin\Admin;
|
||||||
|
use Dcat\Admin\Form;
|
||||||
|
use Dcat\Admin\Grid;
|
||||||
|
|
||||||
|
use Dcat\Admin\Http\Controllers\AdminController;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
|
||||||
|
class PlwController extends AdminController
|
||||||
|
{
|
||||||
|
protected $title = '排列五';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a grid builder.
|
||||||
|
*
|
||||||
|
* @return Grid
|
||||||
|
*/
|
||||||
|
protected function grid()
|
||||||
|
{
|
||||||
|
return Grid::make(Plw::class, function (Grid $grid) {
|
||||||
|
$grid->model()->orderBy('issue_num', 'desc');
|
||||||
|
$grid->column('id', 'id');
|
||||||
|
$grid->column('issue_num', '期号');
|
||||||
|
$grid->column('state', '是否开奖')->display(function () {
|
||||||
|
if ($this->state == BoolEnum::YES) {
|
||||||
|
return '是';
|
||||||
|
}
|
||||||
|
if ($this->state == BoolEnum::NO) {
|
||||||
|
return '否';
|
||||||
|
}
|
||||||
|
return '-';
|
||||||
|
});
|
||||||
|
$grid->column('enable', '销售中')->display(function () {
|
||||||
|
if ($this->enable == BoolEnum::YES) {
|
||||||
|
return '是';
|
||||||
|
}
|
||||||
|
if ($this->enable == BoolEnum::NO) {
|
||||||
|
return '否';
|
||||||
|
}
|
||||||
|
return '-';
|
||||||
|
});
|
||||||
|
$grid->column('close_time', '停售时间');
|
||||||
|
$grid->column('prize_time', '开奖时间');
|
||||||
|
$grid->column('result', '结果')->display(function () {
|
||||||
|
return $this->result ? implode(',', $this->result) : '';
|
||||||
|
});
|
||||||
|
$grid->column('prize', '奖池');
|
||||||
|
$grid->column('__','派奖')
|
||||||
|
->modal(function (Grid\Displayers\Modal $modal){
|
||||||
|
|
||||||
|
// 标题
|
||||||
|
$modal->title('排列五派奖');
|
||||||
|
// 自定义图标
|
||||||
|
$modal->icon('feather icon-navigation');
|
||||||
|
// 传递当前行字段值
|
||||||
|
return SendPrizePlwForm::make()->payload(['id' => $this->id]);
|
||||||
|
})->help('派奖谨慎操作');
|
||||||
|
$grid->fixColumns(2);
|
||||||
|
$grid->filter(function ($filter) {
|
||||||
|
$filter->equal('issue_num', '期号');
|
||||||
|
});
|
||||||
|
$grid->disableViewButton();
|
||||||
|
$grid->disableDeleteButton();
|
||||||
|
$grid->scrollbarX();//数据展开
|
||||||
|
$grid->disableRowSelector();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function form()
|
||||||
|
{
|
||||||
|
return Form::make(new Plw(), function (Form $form) {
|
||||||
|
$form->text('issue_num', '期号')->required();
|
||||||
|
$form->select('state', '是否开奖')->options(BoolEnum::asSelectArray())->required();
|
||||||
|
$form->select('enable', '销售中')->options(BoolEnum::asSelectArray())->required();
|
||||||
|
$form->datetime('close_time', '停售时间');
|
||||||
|
$form->datetime('prize_time', '开奖时间');
|
||||||
|
if ($form->model()->result && is_string($form->model()->result)) {
|
||||||
|
$form->model()->result = json_decode($form->model()->result, true);
|
||||||
|
}
|
||||||
|
$form->model()->result = is_array($form->model()->result) ? implode(',', $form->model()->result) : $form->model()->result;
|
||||||
|
$form->text('result', '结果')->help('以,分割,顺序一定要对');
|
||||||
|
$form->decimal('prize', '奖池')->default(0);
|
||||||
|
$form->divider();
|
||||||
|
$form->saving(function ($form) {
|
||||||
|
if ($form->result) {
|
||||||
|
$form->result = explode(',', $form->result);
|
||||||
|
} else {
|
||||||
|
$form->result = '';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$form->footer(function ($footer) {
|
||||||
|
// 去掉`查看`checkbox
|
||||||
|
$footer->disableViewCheck();
|
||||||
|
// 去掉`继续编辑`checkbox
|
||||||
|
$footer->disableEditingCheck();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,125 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Admin\Forms\SendPrizeDltForm;
|
||||||
|
use App\Admin\Forms\SendPrizePlsForm;
|
||||||
|
use App\Admin\Forms\SendPrizePlwForm;
|
||||||
|
use App\Admin\Forms\SendPrizeQxcForm;
|
||||||
|
use App\Enums\BoolEnum;
|
||||||
|
use App\Model\Pls;
|
||||||
|
use App\Model\Plw;
|
||||||
|
use App\Model\Qxc;
|
||||||
|
use App\Model\Seller\Shop;
|
||||||
|
use App\Model\Seller\ShopPayChannel;
|
||||||
|
use App\Model\Zq\BjdcResult;
|
||||||
|
use App\Utils\Helps;
|
||||||
|
use Dcat\Admin\Admin;
|
||||||
|
use Dcat\Admin\Form;
|
||||||
|
use Dcat\Admin\Grid;
|
||||||
|
|
||||||
|
use Dcat\Admin\Http\Controllers\AdminController;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
|
||||||
|
class QxcController extends AdminController
|
||||||
|
{
|
||||||
|
protected $title = '七星彩';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a grid builder.
|
||||||
|
*
|
||||||
|
* @return Grid
|
||||||
|
*/
|
||||||
|
protected function grid()
|
||||||
|
{
|
||||||
|
return Grid::make(Qxc::class, function (Grid $grid) {
|
||||||
|
$grid->model()->orderBy('issue_num', 'desc');
|
||||||
|
$grid->column('id', 'id');
|
||||||
|
$grid->column('issue_num', '期号');
|
||||||
|
$grid->column('state', '是否开奖')->display(function () {
|
||||||
|
if ($this->state == BoolEnum::YES) {
|
||||||
|
return '是';
|
||||||
|
}
|
||||||
|
if ($this->state == BoolEnum::NO) {
|
||||||
|
return '否';
|
||||||
|
}
|
||||||
|
return '-';
|
||||||
|
});
|
||||||
|
$grid->column('enable', '销售中')->display(function () {
|
||||||
|
if ($this->enable == BoolEnum::YES) {
|
||||||
|
return '是';
|
||||||
|
}
|
||||||
|
if ($this->enable == BoolEnum::NO) {
|
||||||
|
return '否';
|
||||||
|
}
|
||||||
|
return '-';
|
||||||
|
});
|
||||||
|
$grid->column('close_time', '停售时间');
|
||||||
|
$grid->column('prize_time', '开奖时间');
|
||||||
|
$grid->column('result', '结果')->display(function () {
|
||||||
|
return $this->result ? implode(',', $this->result) : '';
|
||||||
|
});
|
||||||
|
$grid->column('prize', '奖池');
|
||||||
|
$grid->column('base1_prize', '一等奖');
|
||||||
|
$grid->column('base2_prize', '二等奖');
|
||||||
|
$grid->column('base3_prize', '三等奖');
|
||||||
|
$grid->column('__','派奖')
|
||||||
|
->modal(function (Grid\Displayers\Modal $modal){
|
||||||
|
|
||||||
|
// 标题
|
||||||
|
$modal->title('大乐透派奖');
|
||||||
|
// 自定义图标
|
||||||
|
$modal->icon('feather icon-navigation');
|
||||||
|
// 传递当前行字段值
|
||||||
|
return SendPrizeQxcForm::make()->payload(['id' => $this->id]);
|
||||||
|
})->help('派奖谨慎操作');
|
||||||
|
$grid->fixColumns(2);
|
||||||
|
$grid->filter(function ($filter) {
|
||||||
|
$filter->equal('issue_num', '期号');
|
||||||
|
});
|
||||||
|
$grid->disableViewButton();
|
||||||
|
$grid->disableDeleteButton();
|
||||||
|
$grid->scrollbarX();//数据展开
|
||||||
|
$grid->disableRowSelector();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function form()
|
||||||
|
{
|
||||||
|
return Form::make(new Qxc(), function (Form $form) {
|
||||||
|
|
||||||
|
$form->text('issue_num', '期号')->required();
|
||||||
|
$form->select('state', '是否开奖')->options(BoolEnum::asSelectArray())->required();
|
||||||
|
$form->select('enable', '销售中')->options(BoolEnum::asSelectArray())->required();
|
||||||
|
$form->datetime('close_time', '停售时间');
|
||||||
|
$form->datetime('prize_time', '开奖时间');
|
||||||
|
if ($form->model()->result && is_string($form->model()->result)) {
|
||||||
|
$form->model()->result = json_decode($form->model()->result, true);
|
||||||
|
}
|
||||||
|
$form->model()->result = is_array($form->model()->result) ? implode(',', $form->model()->result) : $form->model()->result;
|
||||||
|
$form->text('result', '结果')->help('以,分割,顺序一定要对');
|
||||||
|
$form->text('prize', '奖池')->default('');
|
||||||
|
$form->decimal('base1_prize', '一等奖')->default(0);
|
||||||
|
$form->decimal('base2_prize', '二等奖')->default(0);
|
||||||
|
$form->decimal('base3_prize', '三等奖')->default(0);
|
||||||
|
$form->divider();
|
||||||
|
$form->saving(function ($form) {
|
||||||
|
if ($form->result) {
|
||||||
|
$form->result = explode(',', $form->result);
|
||||||
|
} else {
|
||||||
|
$form->result = '';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$form->footer(function ($footer) {
|
||||||
|
// 去掉`查看`checkbox
|
||||||
|
$footer->disableViewCheck();
|
||||||
|
// 去掉`继续编辑`checkbox
|
||||||
|
$footer->disableEditingCheck();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Admin\Forms\ShopBalanceForm;
|
||||||
|
use App\Admin\Model\ReportShopOrder;
|
||||||
|
use App\Enums\LottState;
|
||||||
|
use App\Enums\PayState;
|
||||||
|
use App\Enums\SellerLevel;
|
||||||
|
use App\Model\Config;
|
||||||
|
use App\Model\Lottery;
|
||||||
|
use App\Model\Order;
|
||||||
|
use App\Model\Seller\Seller;
|
||||||
|
use Dcat\Admin\Grid;
|
||||||
|
use Dcat\Admin\Form;
|
||||||
|
use App\Model\Seller\Shop;
|
||||||
|
use App\Model\ShopAgent;
|
||||||
|
|
||||||
|
use App\Admin\Forms\ShopAgentForm;
|
||||||
|
|
||||||
|
use Dcat\Admin\Http\Controllers\AdminController;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Pagination\LengthAwarePaginator;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
|
||||||
|
class ReportShopOrderController extends AdminController
|
||||||
|
{
|
||||||
|
protected $title='店铺订单总额';
|
||||||
|
/**
|
||||||
|
* Make a grid builder.
|
||||||
|
*
|
||||||
|
* @return Grid
|
||||||
|
*/
|
||||||
|
protected function grid()
|
||||||
|
{
|
||||||
|
$perPage = request('per_page', 10);
|
||||||
|
$page = request('page', 1);
|
||||||
|
|
||||||
|
$dateStart = request('date_start', date('Y-m-d'));
|
||||||
|
$dateEnd = request('date_end', date('Y-m-d'));
|
||||||
|
|
||||||
|
$orders = Order::select([
|
||||||
|
'shop_id',
|
||||||
|
DB::raw('SUM(IF(type = 3, union_money, money)) AS money')
|
||||||
|
])
|
||||||
|
->where('pay_state', PayState::SUCCESS)
|
||||||
|
->whereIn('lottery_state', [LottState::WIN, LottState::LOSS, LottState::WAIT, LottState::SEND])
|
||||||
|
->where('created_date', '>=', date('Ymd', strtotime($dateStart)))
|
||||||
|
->where('created_date', '<=', date('Ymd', strtotime($dateEnd)))
|
||||||
|
->groupBy('shop_id')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$shops = collect();
|
||||||
|
$sellers = collect();
|
||||||
|
if (count($orders) > 0) {
|
||||||
|
$shops = Shop::select([
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
'shop_sn',
|
||||||
|
])
|
||||||
|
->whereIn('id', collect($orders)->pluck('shop_id')->toArray())
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$sellers = Seller::select([
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
'phone',
|
||||||
|
'shop_id',
|
||||||
|
])->whereIn('shop_id', collect($orders)->pluck('shop_id')->toArray())
|
||||||
|
->where('level', SellerLevel::MASTER)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
}
|
||||||
|
foreach ($orders as $order) {
|
||||||
|
$shop = collect($shops)->where('id', $order->shop_id)->first();
|
||||||
|
$seller = collect($sellers)->where('shop_id', $order->shop_id)->first();
|
||||||
|
|
||||||
|
$order->seller_id = $seller ? $seller->id : 0;
|
||||||
|
$order->seller_name = $seller ? $seller->name : '';
|
||||||
|
$order->seller_phone = $seller ? $seller->phone : '';
|
||||||
|
$order->shop_id = $shop ? $shop->id : 0;
|
||||||
|
$order->shop_sn = $shop ? $shop->shop_sn : '';
|
||||||
|
$order->shop_name = $shop ? $shop->name : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('admin.report_shop_order', [
|
||||||
|
'orders' => $orders,
|
||||||
|
'dateStart' => $dateStart,
|
||||||
|
'dateEnd' => $dateEnd,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,104 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Enums\BoolEnum;
|
||||||
|
use App\Enums\SellerLevel;
|
||||||
|
use Dcat\Admin\Grid;
|
||||||
|
use Dcat\Admin\Form;
|
||||||
|
use App\Model\Seller\Shop;
|
||||||
|
use App\Model\Seller\Seller;
|
||||||
|
|
||||||
|
use Dcat\Admin\Http\Controllers\AdminController;
|
||||||
|
|
||||||
|
|
||||||
|
class SellerController extends AdminController
|
||||||
|
{
|
||||||
|
protected $title='店主账号管理';
|
||||||
|
/**
|
||||||
|
* Make a grid builder.
|
||||||
|
*
|
||||||
|
* @return Grid
|
||||||
|
*/
|
||||||
|
protected function grid()
|
||||||
|
{
|
||||||
|
return Grid::make(Seller::class, function (Grid $grid) {
|
||||||
|
$grid->model()->orderBy('id', 'desc');
|
||||||
|
|
||||||
|
$grid->column('id','ID');
|
||||||
|
|
||||||
|
$grid->column('name','用户名');
|
||||||
|
$grid->column('nickname','真实名称');
|
||||||
|
$grid->column('phone','手机号');
|
||||||
|
$grid->column('shop_id','店铺名称')->display(function($row){
|
||||||
|
return Shop::where('id',$this->shop_id)->value('name');
|
||||||
|
});
|
||||||
|
$grid->column('email','邮箱');
|
||||||
|
$grid->column('platform_agent','平台代理')->select(BoolEnum::asBoolArray(), true);
|
||||||
|
$grid->column('created_at','创建时间');
|
||||||
|
$grid->filter(function($filter){
|
||||||
|
$filter->panel();
|
||||||
|
$filter->like('name','用户名');
|
||||||
|
$filter->like('nickname','真实名称');
|
||||||
|
$filter->like('phone','手机号');
|
||||||
|
});
|
||||||
|
|
||||||
|
$grid->disableViewButton();
|
||||||
|
// $grid->disableEditButton();
|
||||||
|
$grid->disableDeleteButton();
|
||||||
|
$grid->scrollbarX();//数据展开
|
||||||
|
// $grid->disableActions();
|
||||||
|
// $grid->disableRowSelector();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function form()
|
||||||
|
{
|
||||||
|
return Form::make(new Seller(), function (Form $form) {
|
||||||
|
$form->hidden('level');
|
||||||
|
$form->select('platform_agent','平台代理')
|
||||||
|
->options(BoolEnum::asBoolArray())
|
||||||
|
->default(BoolEnum::NO);
|
||||||
|
$form->tel('name','用户名')->required();
|
||||||
|
$form->text('nickname','真实名')->required();
|
||||||
|
$form->tel('phone','手机号')->required();
|
||||||
|
if ($form->model()->id) {
|
||||||
|
$form->password('password','密码');
|
||||||
|
} else {
|
||||||
|
$form->password('password','密码')->required();
|
||||||
|
}
|
||||||
|
|
||||||
|
$form->select('shop_id','所属店铺')->required()->options(Shop::where("status",1)->pluck('name','id as shop_id'));
|
||||||
|
$form->email('email','店主邮箱')->required();
|
||||||
|
// $form->divider();
|
||||||
|
$form->saving(function ($form) {
|
||||||
|
if ($form->model()->id) {
|
||||||
|
if ($form->password) {
|
||||||
|
$form->password = Seller::encryPassword($form->password);
|
||||||
|
} else {
|
||||||
|
$form->password = $form->model()->password;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$exist = Seller::where('shop_id', $form->shop_id)
|
||||||
|
->where('level', SellerLevel::MASTER)
|
||||||
|
->first();
|
||||||
|
if ($exist) {
|
||||||
|
return $form->response()->error('该店铺有店主,不可重复添加');
|
||||||
|
}
|
||||||
|
$form->level = SellerLevel::MASTER;
|
||||||
|
$form->password = Seller::encryPassword($form->password);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
$form->footer(function($footer) {
|
||||||
|
// 去掉`查看`checkbox
|
||||||
|
$footer->disableViewCheck();
|
||||||
|
// 去掉`继续编辑`checkbox
|
||||||
|
$footer->disableEditingCheck();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use Dcat\Admin\Grid;
|
||||||
|
use Dcat\Admin\Form;
|
||||||
|
use App\Model\ShopAgentBill;
|
||||||
|
use App\Model\ShopAgent;
|
||||||
|
use App\Model\Seller\Shop;
|
||||||
|
|
||||||
|
use Dcat\Admin\Http\Controllers\AdminController;
|
||||||
|
|
||||||
|
|
||||||
|
class ShopAgentBillController extends AdminController
|
||||||
|
{
|
||||||
|
protected $title='代理提成统计';
|
||||||
|
/**
|
||||||
|
* Make a grid builder.
|
||||||
|
*
|
||||||
|
* @return Grid
|
||||||
|
*/
|
||||||
|
protected function grid()
|
||||||
|
{
|
||||||
|
return Grid::make(ShopAgentBill::class, function (Grid $grid) {
|
||||||
|
$grid->model()->where('shop_agent_id','>',0)
|
||||||
|
->selectRaw('shop_agent_id,count(*) as shop_num,sum(amount) as amount_num,sum(agent_amount) as agent_amount_num,sum(use_amount) as use_amount_num')
|
||||||
|
->groupBy('shop_agent_id')
|
||||||
|
->orderBy('agent_amount_num', 'desc');
|
||||||
|
$grid->column('shop_agent_name','代理人')->display(function(){
|
||||||
|
return ShopAgent::where('agent_id',$this->shop_agent_id)->value('agent_name');
|
||||||
|
});
|
||||||
|
$grid->column('shop_num','店铺数');
|
||||||
|
$grid->column('amount_num','流水');
|
||||||
|
$grid->column('use_amount_num','平台服务费')->help('当前平台服务费的抽成点是4‰');
|
||||||
|
$grid->column('agent_amount_num','提成金额')->help("当前一级代理的提成点是".ShopAgentBill::SHOP_AGENT_RATE_ONE.",二级代理的提成点是".ShopAgentBill::SHOP_AGENT_RATE_TWO.",一级代理对手下二级代理业绩的提成点是".ShopAgentBill::SHOP_AGENT_RATE_SUPPER);
|
||||||
|
$grid->fixColumns(-2);
|
||||||
|
$grid->filter(function($filter){
|
||||||
|
$filter->panel();
|
||||||
|
$filter->between('cdate', '日期')->date();
|
||||||
|
$filter->equal('shop_agent_id','代理人')->select(ShopAgent::pluck('agent_name','agent_id'));
|
||||||
|
});
|
||||||
|
|
||||||
|
//导出
|
||||||
|
// $grid->export()->rows(function ($rows) {
|
||||||
|
// foreach ($rows as $k => &$row) {
|
||||||
|
// $row['shop_agent_name'] = ShopAgent::where('agent_id',$rows->shop_agent_id)->value('agent_name');
|
||||||
|
// }
|
||||||
|
// return $rows;
|
||||||
|
// });
|
||||||
|
|
||||||
|
$grid->disableViewButton();
|
||||||
|
$grid->disableEditButton();
|
||||||
|
$grid->disableCreateButton();
|
||||||
|
$grid->disableDeleteButton();
|
||||||
|
$grid->scrollbarX();//数据展开
|
||||||
|
$grid->disableActions();
|
||||||
|
$grid->disableRowSelector();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use Dcat\Admin\Grid;
|
||||||
|
use Dcat\Admin\Form;
|
||||||
|
use App\Model\ShopAgent;
|
||||||
|
|
||||||
|
use Dcat\Admin\Http\Controllers\AdminController;
|
||||||
|
|
||||||
|
|
||||||
|
class ShopAgentController extends AdminController
|
||||||
|
{
|
||||||
|
protected $title='平台代理管理';
|
||||||
|
/**
|
||||||
|
* Make a grid builder.
|
||||||
|
*
|
||||||
|
* @return Grid
|
||||||
|
*/
|
||||||
|
protected function grid()
|
||||||
|
{
|
||||||
|
return Grid::make(ShopAgent::class, function (Grid $grid) {
|
||||||
|
$grid->model()->orderBy('agent_id', 'desc');
|
||||||
|
$grid->column('agent_id','代理ID');
|
||||||
|
$grid->column('agent_status','代理状态')->using(ShopAgent::SHOP_AGENT_STATUS)->label([
|
||||||
|
'default' => 'red', // 设置默认颜色,不设置则默认为 default
|
||||||
|
1 => 'blue'
|
||||||
|
]);
|
||||||
|
$grid->column('agent_name','代理名称');
|
||||||
|
$grid->column('agent_pname','上级代理')->display(function($row){
|
||||||
|
|
||||||
|
return $this->agent_pid==0?'平台一级代理':ShopAgent::where('agent_id',$this->agent_pid)->value('agent_name');
|
||||||
|
});
|
||||||
|
$grid->column('agent_tel','代理电话');
|
||||||
|
$grid->column('agent_wechat','代理微信');
|
||||||
|
$grid->column('agent_remark','代理备注')->width('200');
|
||||||
|
$grid->column('created_at','创建时间');
|
||||||
|
$grid->fixColumns(-2);
|
||||||
|
$grid->filter(function($filter){
|
||||||
|
$filter->panel();
|
||||||
|
$filter->equal('agent_status','代理状态')->select(ShopAgent::SHOP_AGENT_STATUS);
|
||||||
|
$filter->like('agent_name','代理名称');
|
||||||
|
});
|
||||||
|
|
||||||
|
$grid->disableViewButton();
|
||||||
|
// $grid->disableEditButton();
|
||||||
|
$grid->disableDeleteButton();
|
||||||
|
$grid->scrollbarX();//数据展开
|
||||||
|
// $grid->disableActions();
|
||||||
|
$grid->disableRowSelector();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function form()
|
||||||
|
{
|
||||||
|
return Form::make(new ShopAgent(), function (Form $form) {
|
||||||
|
$form->text('agent_name','代理名称')->required();
|
||||||
|
|
||||||
|
$form->select('agent_pid','父级代理')->options(ShopAgent::where('agent_pid',0)->pluck('agent_name','agent_id'))->help('默认不选就是一级代理');
|
||||||
|
$form->text('agent_tel','代理电话')->required();
|
||||||
|
$form->text('agent_wechat','代理微信')->required();
|
||||||
|
$form->radio('agent_status','代理状态')->options(ShopAgent::SHOP_AGENT_STATUS)->default(1)->required();
|
||||||
|
$form->textarea('agent_remark','代理备注');
|
||||||
|
$form->divider();
|
||||||
|
$form->saving(function($form) {
|
||||||
|
$form->agent_pid = $form->agent_pid==''?0:$form->agent_pid;
|
||||||
|
});
|
||||||
|
$form->footer(function($footer) {
|
||||||
|
// 去掉`查看`checkbox
|
||||||
|
$footer->disableViewCheck();
|
||||||
|
// 去掉`继续编辑`checkbox
|
||||||
|
$footer->disableEditingCheck();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,144 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Admin\Forms\ShopBalanceForm;
|
||||||
|
use App\Model\Lottery;
|
||||||
|
use App\Model\Seller\Seller;
|
||||||
|
use App\Model\Seller\ShopBill;
|
||||||
|
use Dcat\Admin\Grid;
|
||||||
|
use Dcat\Admin\Form;
|
||||||
|
use App\Model\Seller\Shop;
|
||||||
|
use App\Model\ShopAgent;
|
||||||
|
|
||||||
|
use App\Admin\Forms\ShopAgentForm;
|
||||||
|
|
||||||
|
use Dcat\Admin\Http\Controllers\AdminController;
|
||||||
|
use Dcat\Admin\Layout\Content;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
|
||||||
|
class ShopController extends AdminController
|
||||||
|
{
|
||||||
|
protected $title='店铺管理';
|
||||||
|
/**
|
||||||
|
* Make a grid builder.
|
||||||
|
*
|
||||||
|
* @return Grid
|
||||||
|
*/
|
||||||
|
protected function grid()
|
||||||
|
{
|
||||||
|
return Grid::make(Shop::class, function (Grid $grid) {
|
||||||
|
$grid->model()->with('agentSeller')->orderBy('id', 'desc');
|
||||||
|
$grid->column('id','店铺ID');
|
||||||
|
$grid->column('shop_sn','店铺编号');
|
||||||
|
$grid->column('status','店铺状态')->using(Shop::SHOP_STATUS)->label([
|
||||||
|
'default' => 'red', // 设置默认颜色,不设置则默认为 default
|
||||||
|
1 => 'blue'
|
||||||
|
]);;
|
||||||
|
$grid->column('name','店铺名称');
|
||||||
|
|
||||||
|
$grid->column('agent_seller_id','平台代理人ID')->modal(function (Grid\Displayers\Modal $modal){
|
||||||
|
|
||||||
|
// 标题
|
||||||
|
$modal->title('设置平台代理人');
|
||||||
|
// 自定义图标
|
||||||
|
$modal->icon('feather icon-edit');
|
||||||
|
// 传递当前行字段值
|
||||||
|
return ShopAgentForm::make()->payload(['id' => $this->id]);
|
||||||
|
});
|
||||||
|
$grid->column('agentSeller','平台代理人')->display(function($item) {
|
||||||
|
|
||||||
|
return $item ? $item->name ."</br>". ($item->phone) : '';
|
||||||
|
});
|
||||||
|
|
||||||
|
$grid->column('balance','店铺余额')->modal(function (Grid\Displayers\Modal $modal){
|
||||||
|
|
||||||
|
// 标题
|
||||||
|
$modal->title('店铺充值');
|
||||||
|
// 自定义图标
|
||||||
|
$modal->icon('feather icon-edit');
|
||||||
|
// 传递当前行字段值
|
||||||
|
return ShopBalanceForm::make()->payload(['id' => $this->id]);
|
||||||
|
});
|
||||||
|
$grid->column('seller_name','店主名称');
|
||||||
|
$grid->column('seller_phone','店铺联系电话');
|
||||||
|
$grid->column('seller_wechat','店铺微信');
|
||||||
|
$grid->column('addr','店铺地址');
|
||||||
|
$grid->column('announcement','店铺公告')->width('200');
|
||||||
|
$grid->column('created_at','创建时间');
|
||||||
|
$grid->fixColumns(-2);
|
||||||
|
$grid->filter(function($filter){
|
||||||
|
$filter->panel();
|
||||||
|
$filter->equal('status','店铺状态')->select(Shop::SHOP_STATUS);
|
||||||
|
$filter->equal('agent_seller_id','平台代理人')->select(Seller::pluck('phone','id'));
|
||||||
|
$filter->like('shop_sn','店铺编号');
|
||||||
|
$filter->like('name','店铺名称');
|
||||||
|
$filter->like('seller_name','店主名称');
|
||||||
|
});
|
||||||
|
|
||||||
|
$grid->disableViewButton();
|
||||||
|
// $grid->disableEditButton();
|
||||||
|
$grid->disableDeleteButton();
|
||||||
|
$grid->scrollbarX();//数据展开
|
||||||
|
// $grid->disableActions();
|
||||||
|
// $grid->disableRowSelector();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function form()
|
||||||
|
{
|
||||||
|
return Form::make(new Shop(), function (Form $form) {
|
||||||
|
$form->hidden('shop_sn');
|
||||||
|
$form->text('name','店铺名称')->required();
|
||||||
|
$form->text('seller_name','店主名称')->required();
|
||||||
|
$form->text('seller_phone','店主联系电话')->required();
|
||||||
|
$form->text('seller_wechat','店主微信')->required();
|
||||||
|
$form->text('addr','店铺地址')->required();
|
||||||
|
$form->text('announcement','店铺公告')->required();
|
||||||
|
$form->text('ali_face_app_auth_token','支付宝授权Token')->help('请谨慎操作');
|
||||||
|
$form->radio('status','店铺状态')->options(Shop::SHOP_STATUS)->required();
|
||||||
|
$form->divider();
|
||||||
|
$form->saving(function($form) {
|
||||||
|
if (!$form->model()->id) {
|
||||||
|
$form->shop_sn = Shop::generateShopSn();
|
||||||
|
Lottery::openAllLottery($form->model()->id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$form->footer(function($footer) {
|
||||||
|
// 去掉`查看`checkbox
|
||||||
|
$footer->disableViewCheck();
|
||||||
|
// 去掉`继续编辑`checkbox
|
||||||
|
$footer->disableEditingCheck();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function compareBill(Request $request, Content $content) {
|
||||||
|
$shopId = $request->input('shop_id');
|
||||||
|
$shopSn = $request->input('shop_sn');
|
||||||
|
if ($shopSn) {
|
||||||
|
$shop = Shop::where('shop_sn', $shopSn)->first();
|
||||||
|
$shopId = $shop->id;
|
||||||
|
}
|
||||||
|
$type = ShopBill::TYPE_INCR;
|
||||||
|
|
||||||
|
$bills = ShopBill::where('type', $type)
|
||||||
|
->where('shop_id', $shopId)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$total = collect($bills)->sum('money');
|
||||||
|
|
||||||
|
$shops = Shop::pluck('name','id')->toArray();
|
||||||
|
|
||||||
|
return $content->title('对店铺加款对账')
|
||||||
|
->body(view('admin.compare_bill', [
|
||||||
|
'data' => $bills,
|
||||||
|
'total' => $total,
|
||||||
|
'shops' => $shops,
|
||||||
|
'shopId' => $shopId,
|
||||||
|
]));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,119 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Enums\AuditState;
|
||||||
|
use App\Enums\BoolEnum;
|
||||||
|
use App\Model\Seller\Shop;
|
||||||
|
use App\Model\Seller\ShopExtra;
|
||||||
|
use App\Model\Seller\ShopPayChannel;
|
||||||
|
use Dcat\Admin\Admin;
|
||||||
|
use Dcat\Admin\Form;
|
||||||
|
use Dcat\Admin\Grid;
|
||||||
|
|
||||||
|
use Dcat\Admin\Http\Controllers\AdminController;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
|
||||||
|
class ShopExtraController extends AdminController
|
||||||
|
{
|
||||||
|
protected $title = '店铺认证管理';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a grid builder.
|
||||||
|
*
|
||||||
|
* @return Grid
|
||||||
|
*/
|
||||||
|
protected function grid()
|
||||||
|
{
|
||||||
|
return Grid::make(ShopExtra::class, function (Grid $grid) {
|
||||||
|
$grid->model()->with('shop')->orderBy('id', 'desc');
|
||||||
|
|
||||||
|
$grid->column('id', 'ID');
|
||||||
|
$grid->column('shop.id', 'SID');
|
||||||
|
$grid->column('shop.name', 'S名称');
|
||||||
|
$grid->column('state', '状态')->display(function ($state) {
|
||||||
|
$states = AuditState::stateAsArray();
|
||||||
|
return Arr::get($states, $state, '-');
|
||||||
|
});
|
||||||
|
$grid->column('business_door_url', '店铺门头照')->image('', 60, 60);
|
||||||
|
$grid->column('sale_proxy_url', '代销证')->image('', 60, 60);
|
||||||
|
$grid->column('sale_proxy_hand_url', '手持代销证')->image('', 60, 60);
|
||||||
|
|
||||||
|
$grid->column('identity_hand_url','手持身份证')->image('', 60, 60);
|
||||||
|
$grid->column('identity_pros_url','身份证反面')->image('', 60, 60);
|
||||||
|
$grid->column('identity_cons_url','身份证正面')->image('', 60, 60);
|
||||||
|
$grid->fixColumns(2);
|
||||||
|
$grid->filter(function ($filter) {
|
||||||
|
$filter->panel();
|
||||||
|
$shops = Shop::pluck('name','id')->toArray();
|
||||||
|
$filter->equal('shop.id', '店铺')->select($shops);
|
||||||
|
$filter->equal('state', '状态')->select(AuditState::stateAsArray());
|
||||||
|
});
|
||||||
|
|
||||||
|
$grid->disableViewButton();
|
||||||
|
$grid->disableCreateButton();
|
||||||
|
$grid->disableDeleteButton();
|
||||||
|
$grid->scrollbarX();//数据展开
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function form()
|
||||||
|
{
|
||||||
|
return Form::make(new ShopExtra(), function (Form $form) {
|
||||||
|
$form->text('id', 'ID')->disable()->readOnly();
|
||||||
|
$form->image('business_door_url', '店铺门头照')
|
||||||
|
->disable()
|
||||||
|
->disable();
|
||||||
|
$form->image('sale_proxy_url', '代销证')
|
||||||
|
->disable()
|
||||||
|
->readOnly();
|
||||||
|
$form->image('sale_proxy_hand_url', '手持代销证')
|
||||||
|
->disable()
|
||||||
|
->readOnly();
|
||||||
|
|
||||||
|
$form->image('identity_hand_url', '手持身份证')
|
||||||
|
->disable()
|
||||||
|
->readOnly();
|
||||||
|
$form->image('identity_cons_url', '身份证正面')
|
||||||
|
->disable()
|
||||||
|
->readOnly();
|
||||||
|
$form->image('identity_pros_url', '身份证反面')
|
||||||
|
->disable()
|
||||||
|
->readOnly();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$form->select('state', '认证状态')->options( AuditState::stateAsArray());
|
||||||
|
$form->text('audit_message', '审核消息');
|
||||||
|
$form->hidden('audit_at');
|
||||||
|
$form->divider();
|
||||||
|
|
||||||
|
$form->saving(function($form) {
|
||||||
|
$form->audit_message = strval($form->audit_message);
|
||||||
|
$form->audit_at = date('Y-m-d H:i:s');
|
||||||
|
unset($form->individual_url);
|
||||||
|
unset($form->business_door_url);
|
||||||
|
unset($form->sale_proxy_url);
|
||||||
|
unset($form->sale_proxy_hand_url);
|
||||||
|
unset($form->identity_pros_url);
|
||||||
|
unset($form->identity_cons_url);
|
||||||
|
unset($form->identity_hand_url);
|
||||||
|
});
|
||||||
|
|
||||||
|
$form->footer(function($footer) {
|
||||||
|
// 去掉`查看`checkbox
|
||||||
|
$footer->disableViewCheck();
|
||||||
|
// 去掉`继续编辑`checkbox
|
||||||
|
$footer->disableEditingCheck();
|
||||||
|
});
|
||||||
|
|
||||||
|
Admin::script(
|
||||||
|
<<<JS
|
||||||
|
$('.file-input').remove()
|
||||||
|
JS
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,187 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Admin\Forms\PayChannelTokenForm;
|
||||||
|
use App\Admin\Forms\ShopWithdrawForm;
|
||||||
|
use App\Enums\BoolEnum;
|
||||||
|
use App\Enums\PayType;
|
||||||
|
use App\Model\Seller\Shop;
|
||||||
|
use App\Model\Seller\ShopPayChannel;
|
||||||
|
use Dcat\Admin\Admin;
|
||||||
|
use Dcat\Admin\Form;
|
||||||
|
use Dcat\Admin\Grid;
|
||||||
|
|
||||||
|
use Dcat\Admin\Http\Controllers\AdminController;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
|
||||||
|
class ShopPayChannelController extends AdminController
|
||||||
|
{
|
||||||
|
protected $title = '渠道';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a grid builder.
|
||||||
|
*
|
||||||
|
* @return Grid
|
||||||
|
*/
|
||||||
|
protected function grid()
|
||||||
|
{
|
||||||
|
return Grid::make(ShopPayChannel::class, function (Grid $grid) {
|
||||||
|
$grid->model()->with('shop')->orderBy('id', 'desc');
|
||||||
|
|
||||||
|
$grid->column('id', 'ID');
|
||||||
|
$grid->column('shop.shop_sn', '店铺编号');
|
||||||
|
$grid->column('shop.name', '店铺名称');
|
||||||
|
$grid->column('pay_type', '支付方式')->display(function ($payType) {
|
||||||
|
$typeName = PayType::getDescription($payType);
|
||||||
|
return $typeName;
|
||||||
|
});
|
||||||
|
$grid->column('pay_channel', '支付渠道');
|
||||||
|
$grid->column('state', '状态')->display(function ($state) {
|
||||||
|
$states = ShopPayChannel::stateAsArray();
|
||||||
|
return Arr::get($states, $state, '-');
|
||||||
|
});
|
||||||
|
$grid->column('audit_message', admin_trans('admin-shop-pay-channel.fields.audit_message'));
|
||||||
|
$grid->column('real_name', admin_trans('admin-shop-pay-channel.fields.real_name'));
|
||||||
|
$grid->column('real_identity', admin_trans('admin-shop-pay-channel.fields.real_identity'));
|
||||||
|
$grid->column('shop_addr', admin_trans('admin-shop-pay-channel.fields.shop_addr'));
|
||||||
|
$grid->column('email', admin_trans('admin-shop-pay-channel.fields.email'));
|
||||||
|
$grid->column('phone', admin_trans('admin-shop-pay-channel.fields.phone'));
|
||||||
|
$grid->column('alipay', admin_trans('admin-shop-pay-channel.fields.alipay'));
|
||||||
|
$grid->column('bank_no', admin_trans('admin-shop-pay-channel.fields.bank_no'));
|
||||||
|
$grid->column('bank_sn', admin_trans('admin-shop-pay-channel.fields.bank_sn'));
|
||||||
|
|
||||||
|
// $grid->column('sale_proxy_url', admin_trans('admin-shop-pay-channel.fields.sale_proxy'))->image('', 60, 60);
|
||||||
|
// $grid->column('business_site_url', admin_trans('admin-shop-pay-channel.fields.business_site'))->image('', 60, 60);
|
||||||
|
// $grid->column('business_door_url', admin_trans('admin-shop-pay-channel.fields.business_door'))->image('', 60, 60);
|
||||||
|
// $grid->column('identity_hand', admin_trans('admin-shop-pay-channel.fields.identity_hand'))->image('', 60, 60);
|
||||||
|
// $grid->column('identity_pros', admin_trans('admin-shop-pay-channel.fields.identity_pros'))->image('http://xxx.com', 60, 60);
|
||||||
|
// $grid->column('identity_cons', admin_trans('admin-shop-pay-channel.fields.identity_cons'))->image('http://xxx.com', 60, 60);
|
||||||
|
// $grid->column('bank_no_pros', admin_trans('admin-shop-pay-channel.fields.bank_no_pros'));
|
||||||
|
|
||||||
|
// $grid->column('wechat_qrcode_url', admin_trans('admin-shop-pay-channel.fields.wechat_qrcode'))->image('', 60, 60);
|
||||||
|
// $grid->column('alipay_qrcode_url', admin_trans('admin-shop-pay-channel.fields.alipay_qrcode'))->image('', 60, 60);
|
||||||
|
$grid->column('remind_after', admin_trans('admin-shop-pay-channel.fields.remind_after'));
|
||||||
|
$grid->column('remind_before', admin_trans('admin-shop-pay-channel.fields.remind_before'));
|
||||||
|
|
||||||
|
$grid->column('ali_face_app_auth_token', '支付宝Token')->modal(function (Grid\Displayers\Modal $modal){
|
||||||
|
|
||||||
|
if ($this->pay_type != PayType::ALIPAY) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 标题
|
||||||
|
$modal->title('配置支付宝Token');
|
||||||
|
// 自定义图标
|
||||||
|
$modal->icon('feather icon-edit');
|
||||||
|
// 传递当前行字段值
|
||||||
|
return PayChannelTokenForm::make()->payload(['id' => $this->id]);
|
||||||
|
});
|
||||||
|
|
||||||
|
$grid->column('opened', '开启')->select(BoolEnum::asSelectArray())->width(80);
|
||||||
|
|
||||||
|
$grid->fixColumns(6);
|
||||||
|
$grid->filter(function ($filter) {
|
||||||
|
$filter->panel();
|
||||||
|
$shops = Shop::pluck('name','id')->toArray();
|
||||||
|
$shopsn = Shop::pluck('shop_sn')->toArray();
|
||||||
|
|
||||||
|
$shopsns = [];
|
||||||
|
foreach ($shopsn as $s) {
|
||||||
|
$shopsns[$s] = $s;
|
||||||
|
}
|
||||||
|
|
||||||
|
$filter->equal('shop.id', '店铺')->select($shops);
|
||||||
|
$filter->equal('shop.shop_sn', '店铺编号')->select($shopsns);
|
||||||
|
$filter->equal('opened', '开启')->select(BoolEnum::asSelectArray());
|
||||||
|
$filter->equal('state', '状态')->select(ShopPayChannel::stateAsArray());
|
||||||
|
});
|
||||||
|
|
||||||
|
$grid->disableViewButton();
|
||||||
|
// $grid->disableEditButton();
|
||||||
|
$grid->disableDeleteButton();
|
||||||
|
$grid->scrollbarX();//数据展开
|
||||||
|
// $grid->disableActions();
|
||||||
|
// $grid->disableRowSelector();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function form()
|
||||||
|
{
|
||||||
|
return Form::make(new ShopPayChannel(), function (Form $form) {
|
||||||
|
$form->text('id', 'ID')->disable()->readOnly();
|
||||||
|
|
||||||
|
$form->text('real_name', admin_trans('admin-shop-pay-channel.fields.real_name'))->disable()
|
||||||
|
->readOnly();
|
||||||
|
$form->text('real_identity', admin_trans('admin-shop-pay-channel.fields.real_identity'))->disable()
|
||||||
|
->readOnly();
|
||||||
|
$form->text('shop_addr', admin_trans('admin-shop-pay-channel.fields.shop_addr'))->disable()
|
||||||
|
->readOnly();
|
||||||
|
$form->text('email', admin_trans('admin-shop-pay-channel.fields.email'))->disable()
|
||||||
|
->readOnly();
|
||||||
|
$form->text('phone', admin_trans('admin-shop-pay-channel.fields.phone'))->disable()
|
||||||
|
->readOnly();
|
||||||
|
$form->text('alipay', admin_trans('admin-shop-pay-channel.fields.alipay'))->disable()
|
||||||
|
->readOnly();
|
||||||
|
$form->text('bank_no', admin_trans('admin-shop-pay-channel.fields.bank_no'))->disable()
|
||||||
|
->readOnly();
|
||||||
|
$form->text('bank_sn', admin_trans('admin-shop-pay-channel.fields.bank_sn'))->disable()
|
||||||
|
->readOnly();
|
||||||
|
|
||||||
|
$form->image('sale_proxy_url', admin_trans('admin-shop-pay-channel.fields.sale_proxy'))
|
||||||
|
->disable()
|
||||||
|
->disable();
|
||||||
|
$form->image('business_site_url', admin_trans('admin-shop-pay-channel.fields.business_site'))
|
||||||
|
->disable()
|
||||||
|
->readOnly();
|
||||||
|
$form->image('business_door_url', admin_trans('admin-shop-pay-channel.fields.business_door'))
|
||||||
|
->disable()
|
||||||
|
->readOnly();
|
||||||
|
|
||||||
|
$form->image('wechat_qrcode_url', admin_trans('admin-shop-pay-channel.fields.wechat_qrcode'))
|
||||||
|
->disable()
|
||||||
|
->readOnly();
|
||||||
|
|
||||||
|
$form->image('alipay_qrcode_url', admin_trans('admin-shop-pay-channel.fields.alipay_qrcode'))
|
||||||
|
->disable()
|
||||||
|
->readOnly();
|
||||||
|
|
||||||
|
$form->text('remind_after', admin_trans('admin-shop-pay-channel.fields.remind_after'))
|
||||||
|
->disable()
|
||||||
|
->readOnly();
|
||||||
|
$form->text('remind_before', admin_trans('admin-shop-pay-channel.fields.remind_before'))
|
||||||
|
->disable()
|
||||||
|
->readOnly();
|
||||||
|
|
||||||
|
$form->select('opened', admin_trans('admin-shop-pay-channel.fields.opened'))->options(BoolEnum::asSelectArray());
|
||||||
|
$form->select('state', admin_trans('admin-shop-pay-channel.fields.state'))->options( ShopPayChannel::stateAsArray());
|
||||||
|
$form->text('audit_message', admin_trans('admin-shop-pay-channel.fields.audit_message'));
|
||||||
|
$form->hidden('audit_at');
|
||||||
|
$form->divider();
|
||||||
|
|
||||||
|
$form->saving(function($form) {
|
||||||
|
$form->audit_message = strval($form->audit_message);
|
||||||
|
$form->audit_at = date('Y-m-d H:i:s');
|
||||||
|
unset($form->wechat_qrcode_url);
|
||||||
|
unset($form->alipay_qrcode_url);
|
||||||
|
unset($form->business_door_url);
|
||||||
|
unset($form->business_site_url);
|
||||||
|
unset($form->sale_proxy_url);
|
||||||
|
});
|
||||||
|
|
||||||
|
$form->footer(function($footer) {
|
||||||
|
// 去掉`查看`checkbox
|
||||||
|
$footer->disableViewCheck();
|
||||||
|
// 去掉`继续编辑`checkbox
|
||||||
|
$footer->disableEditingCheck();
|
||||||
|
});
|
||||||
|
$form->disableDeleteButton();
|
||||||
|
|
||||||
|
Admin::script(
|
||||||
|
<<<JS
|
||||||
|
$('.file-input').remove()
|
||||||
|
JS
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Admin\Forms\ShopWithdrawForm;
|
||||||
|
use App\Enums\PayState;
|
||||||
|
use App\Enums\PayType;
|
||||||
|
use App\Enums\WithdrawState;
|
||||||
|
use App\Enums\WithdrawType;
|
||||||
|
use App\Model\Seller\Seller;
|
||||||
|
use App\Model\Seller\Shop;
|
||||||
|
use App\Model\Seller\ShopRecharge;
|
||||||
|
use App\Model\Seller\ShopWithdraw;
|
||||||
|
use Dcat\Admin\Grid;
|
||||||
|
|
||||||
|
use Dcat\Admin\Http\Controllers\AdminController;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
class ShopRechargeController extends AdminController
|
||||||
|
{
|
||||||
|
protected $title = '店铺充值';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a grid builder.
|
||||||
|
*
|
||||||
|
* @return Grid
|
||||||
|
*/
|
||||||
|
protected function grid()
|
||||||
|
{
|
||||||
|
return Grid::make(ShopRecharge::class, function (Grid $grid) {
|
||||||
|
$grid->model()->with(['shop', 'seller'])
|
||||||
|
->where('pay_state', PayState::SUCCESS)
|
||||||
|
->orderBy('id', 'desc');
|
||||||
|
|
||||||
|
$grid->column('id', 'ID');
|
||||||
|
$grid->column('shop.shop_sn', '店铺编号');
|
||||||
|
$grid->column('shop.name', '店铺名称');
|
||||||
|
$grid->column('seller.id', '充值人ID');
|
||||||
|
$grid->column('seller.name', '充值人名称');
|
||||||
|
$grid->column('pay_money', '充值金额');
|
||||||
|
$grid->column('recharge_sn', '充值单号');
|
||||||
|
$grid->column('pay_type', '充值方式')->display(function ($payType) {
|
||||||
|
return PayType::getDescription($payType);
|
||||||
|
});
|
||||||
|
$grid->column('pay_at', '充值时间');
|
||||||
|
|
||||||
|
$grid->filter(function ($filter) {
|
||||||
|
$filter->panel();
|
||||||
|
$shops = Shop::pluck('name','shop_sn')->toArray();
|
||||||
|
$sellers = Seller::pluck('name','id')->toArray();
|
||||||
|
$filter->equal('shop.shop_sn', '店铺')->select($shops);
|
||||||
|
$filter->equal('seller.name', '充值人')->select($sellers);
|
||||||
|
$filter->between('pay_at', '充值时间')->datetime();
|
||||||
|
});
|
||||||
|
|
||||||
|
$grid->disableViewButton();
|
||||||
|
$grid->disableDeleteButton();
|
||||||
|
$grid->disableActions();
|
||||||
|
$grid->scrollbarX();//数据展开
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Admin\Forms\ShopWithdrawForm;
|
||||||
|
use App\Enums\WithdrawState;
|
||||||
|
use App\Enums\WithdrawType;
|
||||||
|
use App\Model\Seller\Shop;
|
||||||
|
use App\Model\Seller\ShopWithdraw;
|
||||||
|
use Dcat\Admin\Grid;
|
||||||
|
|
||||||
|
use Dcat\Admin\Http\Controllers\AdminController;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
class ShopWithdrawController extends AdminController
|
||||||
|
{
|
||||||
|
protected $title = '店主提现申请';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a grid builder.
|
||||||
|
*
|
||||||
|
* @return Grid
|
||||||
|
*/
|
||||||
|
protected function grid()
|
||||||
|
{
|
||||||
|
return Grid::make(ShopWithdraw::class, function (Grid $grid) {
|
||||||
|
$grid->model()->with('shop')->orderBy('id', 'desc');
|
||||||
|
|
||||||
|
$grid->column('id', 'ID');
|
||||||
|
$grid->column('shop.id', 'SID');
|
||||||
|
$grid->column('shop.name', 'S名称');
|
||||||
|
$grid->column('money', '提现金额');
|
||||||
|
$grid->column('state', '提现审核状态')->display(function ($state) {
|
||||||
|
$states = WithdrawState::stateAsArray();
|
||||||
|
return Arr::get($states, $state, '-');
|
||||||
|
})->modal(function (Grid\Displayers\Modal $modal){
|
||||||
|
|
||||||
|
// 标题
|
||||||
|
$modal->title('提现审核');
|
||||||
|
// 自定义图标
|
||||||
|
$modal->icon('feather icon-edit');
|
||||||
|
// 传递当前行字段值
|
||||||
|
return ShopWithdrawForm::make()->payload(['id' => $this->id]);
|
||||||
|
});
|
||||||
|
$grid->column('admin_remark', '提现审核信息');
|
||||||
|
$grid->column('type', '提现方式')->display(function ($type) {
|
||||||
|
$types = WithdrawType::typeAsArray();
|
||||||
|
return Arr::get($types, $type, '-');
|
||||||
|
});
|
||||||
|
|
||||||
|
$grid->column('ali_account', '支付宝账号');
|
||||||
|
$grid->column('bank_no', '银行卡号');
|
||||||
|
$grid->column('bank_master', '开户行');
|
||||||
|
$grid->column('bank_branch', '银行支行');
|
||||||
|
$grid->column('bank_area', '银行所在地');
|
||||||
|
|
||||||
|
$grid->filter(function ($filter) {
|
||||||
|
$filter->panel();
|
||||||
|
$shops = Shop::pluck('name','id')->toArray();
|
||||||
|
$filter->equal('shop.id', '店铺')->select($shops);
|
||||||
|
$filter->equal('state', '状态')->select(WithdrawState::stateAsArray());
|
||||||
|
$filter->equal('type', '提现方式')->select(WithdrawType::typeAsArray());
|
||||||
|
});
|
||||||
|
|
||||||
|
$grid->disableViewButton();
|
||||||
|
$grid->disableDeleteButton();
|
||||||
|
$grid->disableActions();
|
||||||
|
$grid->scrollbarX();//数据展开
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Forms;
|
||||||
|
|
||||||
|
use App\Model\Customer\Customer;
|
||||||
|
use App\Model\Seller\ShopPayChannel;
|
||||||
|
use Dcat\Admin\Contracts\LazyRenderable;
|
||||||
|
use Dcat\Admin\Traits\LazyWidget;
|
||||||
|
use Dcat\Admin\Widgets\Form;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Log;
|
||||||
|
|
||||||
|
class CustomerPasswordForm extends Form implements LazyRenderable
|
||||||
|
{
|
||||||
|
use LazyWidget;
|
||||||
|
|
||||||
|
public function handle(array $input)
|
||||||
|
{
|
||||||
|
$id = Arr::get($input, 'id');
|
||||||
|
if (!$id) {
|
||||||
|
return $this->response()->alert()->error('参数有误');
|
||||||
|
}
|
||||||
|
$customer = Customer::find($id);
|
||||||
|
if (!$customer) {
|
||||||
|
return $this->response()->alert()->error('数据不存在!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$password = Arr::get($input, 'password');
|
||||||
|
$passwordPay = Arr::get($input, 'password_pay');
|
||||||
|
if (!$password && !$passwordPay) {
|
||||||
|
return $this->response()->alert()->error('密码和支付密码必须填写一个!');
|
||||||
|
}
|
||||||
|
$customer->password = Customer::encryPassword($password);
|
||||||
|
$customer->password_pay = Customer::encryPassword($password);
|
||||||
|
$customer->save();
|
||||||
|
return $this->response()->success("设置成功")->refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function form()
|
||||||
|
{
|
||||||
|
$id = $this->payload['id'];
|
||||||
|
|
||||||
|
$customer = Customer::find($id);
|
||||||
|
if (!$customer) {
|
||||||
|
return $this->response()->alert()->error('数据不存在!');
|
||||||
|
}
|
||||||
|
$this->display('shop_sn','店铺编号')->value($customer->shop->shop_sn);
|
||||||
|
$this->display('shop_name','店铺名称')->value($customer->shop->name);
|
||||||
|
$this->display('phone','手机号')->value($customer->phone);
|
||||||
|
$this->display('name','真实姓名')->value($customer->name);
|
||||||
|
$this->display('nickname','昵称')->value($customer->nickname);
|
||||||
|
|
||||||
|
$this->text('password', '密码')->help('请输入新密码');
|
||||||
|
$this->text('password_pay', '支付密码')->help('请输入新的支付密码');
|
||||||
|
$this->hidden('id')->value($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Forms;
|
||||||
|
|
||||||
|
use App\Console\Commands\Order\CancelRefund;
|
||||||
|
use App\Enums\LottState;
|
||||||
|
use App\Model\Order;
|
||||||
|
use App\Model\Seller\ShopPayChannel;
|
||||||
|
use Dcat\Admin\Contracts\LazyRenderable;
|
||||||
|
use Dcat\Admin\Traits\LazyWidget;
|
||||||
|
use Dcat\Admin\Widgets\Form;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Log;
|
||||||
|
|
||||||
|
class OrderCancelForm extends Form implements LazyRenderable
|
||||||
|
{
|
||||||
|
use LazyWidget;
|
||||||
|
|
||||||
|
public function handle(array $input)
|
||||||
|
{
|
||||||
|
$id = Arr::get($input, 'id');
|
||||||
|
if (!$id) {
|
||||||
|
return $this->response()->alert()->error('参数有误');
|
||||||
|
}
|
||||||
|
$order = Order::find($id);
|
||||||
|
if (!$order) {
|
||||||
|
return $this->response()->alert()->error('数据不存在!');
|
||||||
|
}
|
||||||
|
if (in_array($order->lottery_state, [LottState::WIN,LottState::LOSS, LottState::SEND]) ) {
|
||||||
|
return $this->response()->alert()->error('状态不对,无法退款!');
|
||||||
|
}
|
||||||
|
$cancel = new CancelRefund();
|
||||||
|
$cancel->cancelAndRefund($order);
|
||||||
|
return $this->response()->success("退款成功")->refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function form()
|
||||||
|
{
|
||||||
|
$id = $this->payload['id'];
|
||||||
|
|
||||||
|
$order = Order::find($id);
|
||||||
|
if (!$order) {
|
||||||
|
return $this->response()->alert()->error('数据不存在!');
|
||||||
|
}
|
||||||
|
$this->display('order_sn','订单编号')->value($order->order_sn)->readOnly();
|
||||||
|
$this->display('lottery_state', '订单状态')->value(LottState::getDescription($order->lottery_state))->readOnly();
|
||||||
|
$this->hidden('id')->value($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Forms;
|
||||||
|
|
||||||
|
use App\Model\Seller\ShopPayChannel;
|
||||||
|
use Dcat\Admin\Contracts\LazyRenderable;
|
||||||
|
use Dcat\Admin\Traits\LazyWidget;
|
||||||
|
use Dcat\Admin\Widgets\Form;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Log;
|
||||||
|
|
||||||
|
class PayChannelTokenForm extends Form implements LazyRenderable
|
||||||
|
{
|
||||||
|
use LazyWidget;
|
||||||
|
|
||||||
|
public function handle(array $input)
|
||||||
|
{
|
||||||
|
$id = Arr::get($input, 'id');
|
||||||
|
if (!$id) {
|
||||||
|
return $this->response()->alert()->error('参数有误');
|
||||||
|
}
|
||||||
|
$payChannel = ShopPayChannel::find($id);
|
||||||
|
if (!$payChannel) {
|
||||||
|
return $this->response()->alert()->error('数据不存在!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$token = Arr::get($input, 'ali_face_app_auth_token');
|
||||||
|
if (!$token) {
|
||||||
|
return $this->response()->alert()->error('token 必填!');
|
||||||
|
}
|
||||||
|
$payChannel->ali_face_app_auth_token = $token;
|
||||||
|
$payChannel->save();
|
||||||
|
return $this->response()->success("设置成功")->refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function form()
|
||||||
|
{
|
||||||
|
$id = $this->payload['id'];
|
||||||
|
|
||||||
|
$payChannel = ShopPayChannel::find($id);
|
||||||
|
if (!$payChannel) {
|
||||||
|
return $this->response()->alert()->error('数据不存在!');
|
||||||
|
}
|
||||||
|
$this->display('shop_name','店铺编号')->value($payChannel->shop->shop_sn);
|
||||||
|
$this->display('alipay','支付宝账号')->value($payChannel->alipay);
|
||||||
|
$this->display('pay_channel','支付宝渠道')->value($payChannel->channel_name);
|
||||||
|
$this->text('ali_face_app_auth_token', '支付宝Token')->required();
|
||||||
|
$this->hidden('id')->value($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Forms;
|
||||||
|
|
||||||
|
use App\Exceptions\JingCaiException;
|
||||||
|
use App\Jobs\RefreshOrderDltResult;
|
||||||
|
use App\Jobs\RefreshOrderPlwResult;
|
||||||
|
use App\Model\Dlt;
|
||||||
|
use App\Model\Plw;
|
||||||
|
use Dcat\Admin\Contracts\LazyRenderable;
|
||||||
|
use Dcat\Admin\Traits\LazyWidget;
|
||||||
|
use Dcat\Admin\Widgets\Form;
|
||||||
|
use Arr;
|
||||||
|
use Log;
|
||||||
|
|
||||||
|
class SendPrizeDltForm extends Form implements LazyRenderable
|
||||||
|
{
|
||||||
|
use LazyWidget;
|
||||||
|
|
||||||
|
public function handle(array $input)
|
||||||
|
{
|
||||||
|
if (empty($input)){
|
||||||
|
return $this->response()->alert()->error("设置失败1");
|
||||||
|
}else{
|
||||||
|
|
||||||
|
|
||||||
|
$shop = Dlt::where('id',$input['id'])->first();
|
||||||
|
if (empty($shop)){
|
||||||
|
return $this->response()->alert()->error("设置失败2");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
RefreshOrderDltResult::dispatch($shop->id);
|
||||||
|
} catch (JingCaiException $exception) {
|
||||||
|
return $this->response()->alert()->error($exception->getMessage());
|
||||||
|
}
|
||||||
|
return $this->response()->success("设置成功")->refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function form()
|
||||||
|
{
|
||||||
|
$shop_id = $this->payload['id'];
|
||||||
|
$shops = Dlt::where('id',$shop_id)->first();
|
||||||
|
if (empty($shops)){
|
||||||
|
return $this->response()->alert()->error('无该数据');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->display('issue_num','期号')->value($shops->issue_num);
|
||||||
|
$this->display('qian','红')->value(implode(',',$shops->qian ?: []));
|
||||||
|
$this->display('hou','蓝')->value(implode(',',$shops->hou ?: []));
|
||||||
|
$this->display('prize_time','开奖时间')->value($shops->prize_time);
|
||||||
|
$this->hidden('id')->value($shop_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Forms;
|
||||||
|
|
||||||
|
use App\Exceptions\JingCaiException;
|
||||||
|
use App\Jobs\RefreshOrderPlsResult;
|
||||||
|
use App\Model\Pls;
|
||||||
|
use Dcat\Admin\Contracts\LazyRenderable;
|
||||||
|
use Dcat\Admin\Traits\LazyWidget;
|
||||||
|
use Dcat\Admin\Widgets\Form;
|
||||||
|
use Arr;
|
||||||
|
use Log;
|
||||||
|
|
||||||
|
class SendPrizePlsForm extends Form implements LazyRenderable
|
||||||
|
{
|
||||||
|
use LazyWidget;
|
||||||
|
|
||||||
|
public function handle(array $input)
|
||||||
|
{
|
||||||
|
if (empty($input)){
|
||||||
|
return $this->response()->alert()->error("设置失败1");
|
||||||
|
}else{
|
||||||
|
|
||||||
|
|
||||||
|
$shop = Pls::where('id',$input['id'])->first();
|
||||||
|
if (empty($shop)){
|
||||||
|
return $this->response()->alert()->error("设置失败2");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
RefreshOrderPlsResult::dispatch($shop->id);
|
||||||
|
} catch (JingCaiException $exception) {
|
||||||
|
return $this->response()->alert()->error($exception->getMessage());
|
||||||
|
}
|
||||||
|
return $this->response()->success("设置成功")->refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function form()
|
||||||
|
{
|
||||||
|
$shop_id = $this->payload['id'];
|
||||||
|
$shops = Pls::where('id',$shop_id)->first();
|
||||||
|
if (empty($shops)){
|
||||||
|
return $this->response()->alert()->error('无该数据');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->display('issue_num','期号')->value($shops->issue_num);
|
||||||
|
$this->display('result','结果')->value(implode(',',$shops->result ?: []));
|
||||||
|
$this->display('prize_time','开奖时间')->value($shops->prize_time);
|
||||||
|
$this->hidden('id')->value($shop_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Forms;
|
||||||
|
|
||||||
|
use App\Exceptions\JingCaiException;
|
||||||
|
use App\Jobs\RefreshOrderPlwResult;
|
||||||
|
use App\Model\Plw;
|
||||||
|
use Dcat\Admin\Contracts\LazyRenderable;
|
||||||
|
use Dcat\Admin\Traits\LazyWidget;
|
||||||
|
use Dcat\Admin\Widgets\Form;
|
||||||
|
use Arr;
|
||||||
|
use Log;
|
||||||
|
|
||||||
|
class SendPrizePlwForm extends Form implements LazyRenderable
|
||||||
|
{
|
||||||
|
use LazyWidget;
|
||||||
|
|
||||||
|
public function handle(array $input)
|
||||||
|
{
|
||||||
|
if (empty($input)){
|
||||||
|
return $this->response()->alert()->error("设置失败1");
|
||||||
|
}else{
|
||||||
|
|
||||||
|
|
||||||
|
$shop = Plw::where('id',$input['id'])->first();
|
||||||
|
if (empty($shop)){
|
||||||
|
return $this->response()->alert()->error("设置失败2");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
RefreshOrderPlwResult::dispatch($shop->id);
|
||||||
|
} catch (JingCaiException $exception) {
|
||||||
|
return $this->response()->alert()->error($exception->getMessage());
|
||||||
|
}
|
||||||
|
return $this->response()->success("设置成功")->refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function form()
|
||||||
|
{
|
||||||
|
$shop_id = $this->payload['id'];
|
||||||
|
$shops = Plw::where('id',$shop_id)->first();
|
||||||
|
if (empty($shops)){
|
||||||
|
return $this->response()->alert()->error('无该数据');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->display('issue_num','期号')->value($shops->issue_num);
|
||||||
|
$this->display('result','结果')->value(implode(',',$shops->result ?: []));
|
||||||
|
$this->display('prize_time','开奖时间')->value($shops->prize_time);
|
||||||
|
$this->hidden('id')->value($shop_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Forms;
|
||||||
|
|
||||||
|
use App\Exceptions\JingCaiException;
|
||||||
|
use App\Jobs\RefreshOrderPlwResult;
|
||||||
|
use App\Jobs\RefreshOrderQxcResult;
|
||||||
|
use App\Model\Plw;
|
||||||
|
use App\Model\Qxc;
|
||||||
|
use Dcat\Admin\Contracts\LazyRenderable;
|
||||||
|
use Dcat\Admin\Traits\LazyWidget;
|
||||||
|
use Dcat\Admin\Widgets\Form;
|
||||||
|
use Arr;
|
||||||
|
use Log;
|
||||||
|
|
||||||
|
class SendPrizeQxcForm extends Form implements LazyRenderable
|
||||||
|
{
|
||||||
|
use LazyWidget;
|
||||||
|
|
||||||
|
public function handle(array $input)
|
||||||
|
{
|
||||||
|
if (empty($input)){
|
||||||
|
return $this->response()->alert()->error("设置失败1");
|
||||||
|
}else{
|
||||||
|
|
||||||
|
|
||||||
|
$shop = Qxc::where('id',$input['id'])->first();
|
||||||
|
if (empty($shop)){
|
||||||
|
return $this->response()->alert()->error("设置失败2");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
RefreshOrderQxcResult::dispatch($shop->id);
|
||||||
|
} catch (JingCaiException $exception) {
|
||||||
|
return $this->response()->alert()->error($exception->getMessage());
|
||||||
|
}
|
||||||
|
return $this->response()->success("设置成功")->refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function form()
|
||||||
|
{
|
||||||
|
$shop_id = $this->payload['id'];
|
||||||
|
$shops = Qxc::where('id',$shop_id)->first();
|
||||||
|
if (empty($shops)){
|
||||||
|
return $this->response()->alert()->error('无该数据');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->display('issue_num','期号')->value($shops->issue_num);
|
||||||
|
$this->display('result','结果')->value(implode(',',$shops->result ?: []));
|
||||||
|
$this->display('prize_time','开奖时间')->value($shops->prize_time);
|
||||||
|
$this->hidden('id')->value($shop_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Forms;
|
||||||
|
|
||||||
|
use App\Model\Seller\Seller;
|
||||||
|
use App\Model\Seller\Shop;
|
||||||
|
use Dcat\Admin\Contracts\LazyRenderable;
|
||||||
|
use Dcat\Admin\Traits\LazyWidget;
|
||||||
|
use Dcat\Admin\Widgets\Form;
|
||||||
|
|
||||||
|
class ShopAgentForm extends Form implements LazyRenderable
|
||||||
|
{
|
||||||
|
use LazyWidget;
|
||||||
|
|
||||||
|
public function handle(array $input)
|
||||||
|
{
|
||||||
|
if (empty($input)){
|
||||||
|
return $this->response()->alert()->error("设置失败1");
|
||||||
|
}else{
|
||||||
|
$agent_seller_id = (int)data_get($input,'agent_seller_id',0);
|
||||||
|
|
||||||
|
$agentSeller = Seller::find($agent_seller_id);
|
||||||
|
if (!$agentSeller) {
|
||||||
|
return $this->response()->alert()->error("该代理不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
$shop = Shop::where('id',$input['id'])->first();
|
||||||
|
if (empty($shop)){
|
||||||
|
return $this->response()->alert()->error("店铺不存在");
|
||||||
|
}
|
||||||
|
$shop->agent_seller_id = $agentSeller->id;
|
||||||
|
$shop->agent_shop_id = $agentSeller->shop_id;
|
||||||
|
$shop->save();
|
||||||
|
return $this->response()->success("设置成功")->refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function form()
|
||||||
|
{
|
||||||
|
$shop_id = $this->payload['id'];
|
||||||
|
$shops = Shop::where('id',$shop_id)->first();
|
||||||
|
$this->display('shop_sn','店铺编号')->with(function ($item)use($shops){
|
||||||
|
return $shops['shop_sn'];
|
||||||
|
});
|
||||||
|
$this->display('shop_name','店铺名称')->with(function ($item)use($shops){
|
||||||
|
return $shops['name'];
|
||||||
|
});
|
||||||
|
$this->select('agent_seller_id','平台代理')->options(Seller::pluck('name','id'))->help('请谨慎选择正确的平台代理');
|
||||||
|
$this->hidden('id')->value($shop_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Forms;
|
||||||
|
|
||||||
|
use App\Exceptions\JingCaiException;
|
||||||
|
use App\Model\ShopAgent;
|
||||||
|
use App\Model\Seller\Shop;
|
||||||
|
use App\Service\SellerWalletService;
|
||||||
|
use Dcat\Admin\Contracts\LazyRenderable;
|
||||||
|
use Dcat\Admin\Traits\LazyWidget;
|
||||||
|
use Dcat\Admin\Widgets\Form;
|
||||||
|
use Arr;
|
||||||
|
use Log;
|
||||||
|
|
||||||
|
class ShopBalanceForm extends Form implements LazyRenderable
|
||||||
|
{
|
||||||
|
use LazyWidget;
|
||||||
|
|
||||||
|
public function handle(array $input)
|
||||||
|
{
|
||||||
|
if (empty($input)){
|
||||||
|
return $this->response()->alert()->error("设置失败1");
|
||||||
|
}else{
|
||||||
|
$balance_cash = data_get($input,'balance_cash',0);
|
||||||
|
|
||||||
|
$shop = Shop::where('id',$input['id'])->first();
|
||||||
|
if (empty($shop)){
|
||||||
|
return $this->response()->alert()->error("设置失败2");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
SellerWalletService::adminRecharge($shop->id,auth('admin')->user()->id, $balance_cash);
|
||||||
|
} catch (JingCaiException $exception) {
|
||||||
|
return $this->response()->alert()->error($exception->getMessage());
|
||||||
|
}
|
||||||
|
return $this->response()->success("设置成功")->refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function form()
|
||||||
|
{
|
||||||
|
$shop_id = $this->payload['id'];
|
||||||
|
$shops = Shop::where('id',$shop_id)->first();
|
||||||
|
|
||||||
|
$this->display('shop_name','店铺名称')->with(function ($item)use($shops){
|
||||||
|
return $shops['name'];
|
||||||
|
});
|
||||||
|
$this->text('balance_cash','店铺余额');
|
||||||
|
$this->hidden('id')->value($shop_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Forms;
|
||||||
|
|
||||||
|
use App\Enums\WithdrawState;
|
||||||
|
use App\Enums\WithdrawType;
|
||||||
|
use App\Model\Seller\ShopWithdraw;
|
||||||
|
use Dcat\Admin\Contracts\LazyRenderable;
|
||||||
|
use Dcat\Admin\Traits\LazyWidget;
|
||||||
|
use Dcat\Admin\Widgets\Form;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Log;
|
||||||
|
|
||||||
|
class ShopWithdrawForm extends Form implements LazyRenderable
|
||||||
|
{
|
||||||
|
use LazyWidget;
|
||||||
|
|
||||||
|
public function handle(array $input)
|
||||||
|
{
|
||||||
|
$id = Arr::get($input, 'id');
|
||||||
|
if (!$id) {
|
||||||
|
return $this->response()->alert()->error('参数有误');
|
||||||
|
}
|
||||||
|
$shopWithdraw = ShopWithdraw::find($id);
|
||||||
|
if (!$shopWithdraw) {
|
||||||
|
return $this->response()->alert()->error('数据不存在!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$state = Arr::get($input, 'state');
|
||||||
|
|
||||||
|
if (!WithdrawState::hasValue($state, false)) {
|
||||||
|
return $this->response()->alert()->error('状态有误!');
|
||||||
|
}
|
||||||
|
$admin_remark = Arr::get($input, 'admin_remark');
|
||||||
|
$shopWithdraw->state = $state;
|
||||||
|
$shopWithdraw->admin_remark = strval($admin_remark);
|
||||||
|
$shopWithdraw->remark_at = date('Y-m-d H:i:s');
|
||||||
|
$shopWithdraw->save();
|
||||||
|
return $this->response()->success("设置成功")->refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function form()
|
||||||
|
{
|
||||||
|
$id = $this->payload['id'];
|
||||||
|
$shopWithdraw = ShopWithdraw::find($id);
|
||||||
|
if (!$shopWithdraw) {
|
||||||
|
return $this->response()->alert()->error('数据不存在!');
|
||||||
|
}
|
||||||
|
$this->display('shop_name','店铺名称')->with(function ($item)use($shopWithdraw){
|
||||||
|
return $shopWithdraw->shop->name;
|
||||||
|
});
|
||||||
|
|
||||||
|
$types = WithdrawType::typeAsArray();
|
||||||
|
$this->text('type', '提现方式')
|
||||||
|
->value(Arr::get($types, $shopWithdraw->type))->readOnly();
|
||||||
|
if ($shopWithdraw->type == WithdrawType::ALI) {
|
||||||
|
$this->text('ali_account', '支付宝账号')
|
||||||
|
->value($shopWithdraw->ali_account)
|
||||||
|
->readOnly();
|
||||||
|
} else {
|
||||||
|
$this->text('bank_master', '开户行')
|
||||||
|
->value($shopWithdraw->bank_master)
|
||||||
|
->readOnly();
|
||||||
|
$this->text('bank_branch', '支行')
|
||||||
|
->value($shopWithdraw->bank_branch)
|
||||||
|
->readOnly();
|
||||||
|
$this->text('bank_no', '银行卡号')
|
||||||
|
->value($shopWithdraw->bank_no)
|
||||||
|
->readOnly();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->select('state','提现审核状态')
|
||||||
|
->options(WithdrawState::stateAsArray())
|
||||||
|
->value($shopWithdraw->state)
|
||||||
|
->help('请谨慎设置提现状态');
|
||||||
|
$this->text('admin_remark', '提现审核信息')->value($shopWithdraw->admin_remark);
|
||||||
|
$this->hidden('id')->value($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Metrics\Examples;
|
||||||
|
|
||||||
|
use Dcat\Admin\Admin;
|
||||||
|
use Dcat\Admin\Widgets\Metrics\Donut;
|
||||||
|
|
||||||
|
class NewDevices extends Donut
|
||||||
|
{
|
||||||
|
protected $labels = ['Desktop', 'Mobile'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化卡片内容
|
||||||
|
*/
|
||||||
|
protected function init()
|
||||||
|
{
|
||||||
|
parent::init();
|
||||||
|
|
||||||
|
$color = Admin::color();
|
||||||
|
$colors = [$color->primary(), $color->alpha('blue2', 0.5)];
|
||||||
|
|
||||||
|
$this->title('New Devices');
|
||||||
|
$this->subTitle('Last 30 days');
|
||||||
|
$this->chartLabels($this->labels);
|
||||||
|
// 设置图表颜色
|
||||||
|
$this->chartColors($colors);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 渲染模板
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
$this->fill();
|
||||||
|
|
||||||
|
return parent::render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 写入数据.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function fill()
|
||||||
|
{
|
||||||
|
$this->withContent(44.9, 28.6);
|
||||||
|
|
||||||
|
// 图表数据
|
||||||
|
$this->withChart([44.9, 28.6]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置图表数据.
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withChart(array $data)
|
||||||
|
{
|
||||||
|
return $this->chart([
|
||||||
|
'series' => $data
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置卡片头部内容.
|
||||||
|
*
|
||||||
|
* @param mixed $desktop
|
||||||
|
* @param mixed $mobile
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
protected function withContent($desktop, $mobile)
|
||||||
|
{
|
||||||
|
$blue = Admin::color()->alpha('blue2', 0.5);
|
||||||
|
|
||||||
|
$style = 'margin-bottom: 8px';
|
||||||
|
$labelWidth = 120;
|
||||||
|
|
||||||
|
return $this->content(
|
||||||
|
<<<HTML
|
||||||
|
<div class="d-flex pl-1 pr-1 pt-1" style="{$style}">
|
||||||
|
<div style="width: {$labelWidth}px">
|
||||||
|
<i class="fa fa-circle text-primary"></i> {$this->labels[0]}
|
||||||
|
</div>
|
||||||
|
<div>{$desktop}</div>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex pl-1 pr-1" style="{$style}">
|
||||||
|
<div style="width: {$labelWidth}px">
|
||||||
|
<i class="fa fa-circle" style="color: $blue"></i> {$this->labels[1]}
|
||||||
|
</div>
|
||||||
|
<div>{$mobile}</div>
|
||||||
|
</div>
|
||||||
|
HTML
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,108 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Metrics\Examples;
|
||||||
|
|
||||||
|
use Dcat\Admin\Widgets\Metrics\Line;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class NewUsers extends Line
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 初始化卡片内容
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function init()
|
||||||
|
{
|
||||||
|
parent::init();
|
||||||
|
|
||||||
|
$this->title('New Users');
|
||||||
|
$this->dropdown([
|
||||||
|
'7' => 'Last 7 Days',
|
||||||
|
'28' => 'Last 28 Days',
|
||||||
|
'30' => 'Last Month',
|
||||||
|
'365' => 'Last Year',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理请求
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
*
|
||||||
|
* @return mixed|void
|
||||||
|
*/
|
||||||
|
public function handle(Request $request)
|
||||||
|
{
|
||||||
|
$generator = function ($len, $min = 10, $max = 300) {
|
||||||
|
for ($i = 0; $i <= $len; $i++) {
|
||||||
|
yield mt_rand($min, $max);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
switch ($request->get('option')) {
|
||||||
|
case '365':
|
||||||
|
// 卡片内容
|
||||||
|
$this->withContent(mt_rand(1000, 5000).'k');
|
||||||
|
// 图表数据
|
||||||
|
$this->withChart(collect($generator(30))->toArray());
|
||||||
|
break;
|
||||||
|
case '30':
|
||||||
|
// 卡片内容
|
||||||
|
$this->withContent(mt_rand(400, 1000).'k');
|
||||||
|
// 图表数据
|
||||||
|
$this->withChart(collect($generator(30))->toArray());
|
||||||
|
break;
|
||||||
|
case '28':
|
||||||
|
// 卡片内容
|
||||||
|
$this->withContent(mt_rand(400, 1000).'k');
|
||||||
|
// 图表数据
|
||||||
|
$this->withChart(collect($generator(28))->toArray());
|
||||||
|
break;
|
||||||
|
case '7':
|
||||||
|
default:
|
||||||
|
// 卡片内容
|
||||||
|
$this->withContent('89.2k');
|
||||||
|
// 图表数据
|
||||||
|
$this->withChart([28, 40, 36, 52, 38, 60, 55,]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置图表数据.
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withChart(array $data)
|
||||||
|
{
|
||||||
|
return $this->chart([
|
||||||
|
'series' => [
|
||||||
|
[
|
||||||
|
'name' => $this->title,
|
||||||
|
'data' => $data,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置卡片内容.
|
||||||
|
*
|
||||||
|
* @param string $content
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withContent($content)
|
||||||
|
{
|
||||||
|
return $this->content(
|
||||||
|
<<<HTML
|
||||||
|
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px">
|
||||||
|
<h2 class="ml-1 font-lg-1">{$content}</h2>
|
||||||
|
<span class="mb-0 mr-1 text-80">{$this->title}</span>
|
||||||
|
</div>
|
||||||
|
HTML
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,114 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Metrics\Examples;
|
||||||
|
|
||||||
|
use Dcat\Admin\Widgets\Metrics\Round;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ProductOrders extends Round
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 初始化卡片内容
|
||||||
|
*/
|
||||||
|
protected function init()
|
||||||
|
{
|
||||||
|
parent::init();
|
||||||
|
|
||||||
|
$this->title('Product Orders');
|
||||||
|
$this->chartLabels(['Finished', 'Pending', 'Rejected']);
|
||||||
|
$this->dropdown([
|
||||||
|
'7' => 'Last 7 Days',
|
||||||
|
'28' => 'Last 28 Days',
|
||||||
|
'30' => 'Last Month',
|
||||||
|
'365' => 'Last Year',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理请求
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
*
|
||||||
|
* @return mixed|void
|
||||||
|
*/
|
||||||
|
public function handle(Request $request)
|
||||||
|
{
|
||||||
|
switch ($request->get('option')) {
|
||||||
|
case '365':
|
||||||
|
case '30':
|
||||||
|
case '28':
|
||||||
|
case '7':
|
||||||
|
default:
|
||||||
|
// 卡片内容
|
||||||
|
$this->withContent(23043, 14658, 4758);
|
||||||
|
|
||||||
|
// 图表数据
|
||||||
|
$this->withChart([70, 52, 26]);
|
||||||
|
|
||||||
|
// 总数
|
||||||
|
$this->chartTotal('Total', 344);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置图表数据.
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withChart(array $data)
|
||||||
|
{
|
||||||
|
return $this->chart([
|
||||||
|
'series' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡片内容.
|
||||||
|
*
|
||||||
|
* @param int $finished
|
||||||
|
* @param int $pending
|
||||||
|
* @param int $rejected
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withContent($finished, $pending, $rejected)
|
||||||
|
{
|
||||||
|
return $this->content(
|
||||||
|
<<<HTML
|
||||||
|
<div class="col-12 d-flex flex-column flex-wrap text-center" style="max-width: 220px">
|
||||||
|
<div class="chart-info d-flex justify-content-between mb-1 mt-2" >
|
||||||
|
<div class="series-info d-flex align-items-center">
|
||||||
|
<i class="fa fa-circle-o text-bold-700 text-primary"></i>
|
||||||
|
<span class="text-bold-600 ml-50">Finished</span>
|
||||||
|
</div>
|
||||||
|
<div class="product-result">
|
||||||
|
<span>{$finished}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="chart-info d-flex justify-content-between mb-1">
|
||||||
|
<div class="series-info d-flex align-items-center">
|
||||||
|
<i class="fa fa-circle-o text-bold-700 text-warning"></i>
|
||||||
|
<span class="text-bold-600 ml-50">Pending</span>
|
||||||
|
</div>
|
||||||
|
<div class="product-result">
|
||||||
|
<span>{$pending}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="chart-info d-flex justify-content-between mb-1">
|
||||||
|
<div class="series-info d-flex align-items-center">
|
||||||
|
<i class="fa fa-circle-o text-bold-700 text-danger"></i>
|
||||||
|
<span class="text-bold-600 ml-50">Rejected</span>
|
||||||
|
</div>
|
||||||
|
<div class="product-result">
|
||||||
|
<span>{$rejected}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
HTML
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,117 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Metrics\Examples;
|
||||||
|
|
||||||
|
use Dcat\Admin\Admin;
|
||||||
|
use Dcat\Admin\Widgets\Metrics\Bar;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class Sessions extends Bar
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 初始化卡片内容
|
||||||
|
*/
|
||||||
|
protected function init()
|
||||||
|
{
|
||||||
|
parent::init();
|
||||||
|
|
||||||
|
$color = Admin::color();
|
||||||
|
|
||||||
|
$dark35 = $color->dark35();
|
||||||
|
|
||||||
|
// 卡片内容宽度
|
||||||
|
$this->contentWidth(5, 7);
|
||||||
|
// 标题
|
||||||
|
$this->title('Avg Sessions');
|
||||||
|
// 设置下拉选项
|
||||||
|
$this->dropdown([
|
||||||
|
'7' => 'Last 7 Days',
|
||||||
|
'28' => 'Last 28 Days',
|
||||||
|
'30' => 'Last Month',
|
||||||
|
'365' => 'Last Year',
|
||||||
|
]);
|
||||||
|
// 设置图表颜色
|
||||||
|
$this->chartColors([
|
||||||
|
$dark35,
|
||||||
|
$dark35,
|
||||||
|
$color->primary(),
|
||||||
|
$dark35,
|
||||||
|
$dark35,
|
||||||
|
$dark35
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理请求
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
*
|
||||||
|
* @return mixed|void
|
||||||
|
*/
|
||||||
|
public function handle(Request $request)
|
||||||
|
{
|
||||||
|
switch ($request->get('option')) {
|
||||||
|
case '7':
|
||||||
|
default:
|
||||||
|
// 卡片内容
|
||||||
|
$this->withContent('2.7k', '+5.2%');
|
||||||
|
|
||||||
|
// 图表数据
|
||||||
|
$this->withChart([
|
||||||
|
[
|
||||||
|
'name' => 'Sessions',
|
||||||
|
'data' => [75, 125, 225, 175, 125, 75, 25],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置图表数据.
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withChart(array $data)
|
||||||
|
{
|
||||||
|
return $this->chart([
|
||||||
|
'series' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置卡片内容.
|
||||||
|
*
|
||||||
|
* @param string $title
|
||||||
|
* @param string $value
|
||||||
|
* @param string $style
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withContent($title, $value, $style = 'success')
|
||||||
|
{
|
||||||
|
// 根据选项显示
|
||||||
|
$label = strtolower(
|
||||||
|
$this->dropdown[request()->option] ?? 'last 7 days'
|
||||||
|
);
|
||||||
|
|
||||||
|
$minHeight = '183px';
|
||||||
|
|
||||||
|
return $this->content(
|
||||||
|
<<<HTML
|
||||||
|
<div class="d-flex p-1 flex-column justify-content-between" style="padding-top: 0;width: 100%;height: 100%;min-height: {$minHeight}">
|
||||||
|
<div class="text-left">
|
||||||
|
<h1 class="font-lg-2 mt-2 mb-0">{$title}</h1>
|
||||||
|
<h5 class="font-medium-2" style="margin-top: 10px;">
|
||||||
|
<span class="text-{$style}">{$value} </span>
|
||||||
|
<span>vs {$label}</span>
|
||||||
|
</h5>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a href="#" class="btn btn-primary shadow waves-effect waves-light">View Details <i class="feather icon-chevrons-right"></i></a>
|
||||||
|
</div>
|
||||||
|
HTML
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,116 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Metrics\Examples;
|
||||||
|
|
||||||
|
use Dcat\Admin\Widgets\Metrics\RadialBar;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class Tickets extends RadialBar
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 初始化卡片内容
|
||||||
|
*/
|
||||||
|
protected function init()
|
||||||
|
{
|
||||||
|
parent::init();
|
||||||
|
|
||||||
|
$this->title('Tickets');
|
||||||
|
$this->height(400);
|
||||||
|
$this->chartHeight(300);
|
||||||
|
$this->chartLabels('Completed Tickets');
|
||||||
|
$this->dropdown([
|
||||||
|
'7' => 'Last 7 Days',
|
||||||
|
'28' => 'Last 28 Days',
|
||||||
|
'30' => 'Last Month',
|
||||||
|
'365' => 'Last Year',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理请求
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
*
|
||||||
|
* @return mixed|void
|
||||||
|
*/
|
||||||
|
public function handle(Request $request)
|
||||||
|
{
|
||||||
|
switch ($request->get('option')) {
|
||||||
|
case '365':
|
||||||
|
case '30':
|
||||||
|
case '28':
|
||||||
|
case '7':
|
||||||
|
default:
|
||||||
|
// 卡片内容
|
||||||
|
$this->withContent(162);
|
||||||
|
// 卡片底部
|
||||||
|
$this->withFooter(29, 63, '1d');
|
||||||
|
// 图表数据
|
||||||
|
$this->withChart(83);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置图表数据.
|
||||||
|
*
|
||||||
|
* @param int $data
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withChart(int $data)
|
||||||
|
{
|
||||||
|
return $this->chart([
|
||||||
|
'series' => [$data],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡片内容
|
||||||
|
*
|
||||||
|
* @param string $content
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withContent($content)
|
||||||
|
{
|
||||||
|
return $this->content(
|
||||||
|
<<<HTML
|
||||||
|
<div class="d-flex flex-column flex-wrap text-center">
|
||||||
|
<h1 class="font-lg-2 mt-2 mb-0">{$content}</h1>
|
||||||
|
<small>Tickets</small>
|
||||||
|
</div>
|
||||||
|
HTML
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡片底部内容.
|
||||||
|
*
|
||||||
|
* @param string $new
|
||||||
|
* @param string $open
|
||||||
|
* @param string $response
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withFooter($new, $open, $response)
|
||||||
|
{
|
||||||
|
return $this->footer(
|
||||||
|
<<<HTML
|
||||||
|
<div class="d-flex justify-content-between p-1" style="padding-top: 0!important;">
|
||||||
|
<div class="text-center">
|
||||||
|
<p>New Tickets</p>
|
||||||
|
<span class="font-lg-1">{$new}</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-center">
|
||||||
|
<p>Open Tickets</p>
|
||||||
|
<span class="font-lg-1">{$open}</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-center">
|
||||||
|
<p>Response Time</p>
|
||||||
|
<span class="font-lg-1">{$response}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
HTML
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,129 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Metrics\Examples;
|
||||||
|
|
||||||
|
use Dcat\Admin\Widgets\Metrics\Card;
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class TotalUsers extends Card
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 卡片底部内容.
|
||||||
|
*
|
||||||
|
* @var string|Renderable|\Closure
|
||||||
|
*/
|
||||||
|
protected $footer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化卡片.
|
||||||
|
*/
|
||||||
|
protected function init()
|
||||||
|
{
|
||||||
|
parent::init();
|
||||||
|
|
||||||
|
$this->title('Total Users');
|
||||||
|
$this->dropdown([
|
||||||
|
'7' => 'Last 7 Days',
|
||||||
|
'28' => 'Last 28 Days',
|
||||||
|
'30' => 'Last Month',
|
||||||
|
'365' => 'Last Year',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理请求.
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function handle(Request $request)
|
||||||
|
{
|
||||||
|
switch ($request->get('option')) {
|
||||||
|
case '365':
|
||||||
|
$this->content(mt_rand(600, 1500));
|
||||||
|
$this->down(mt_rand(1, 30));
|
||||||
|
break;
|
||||||
|
case '30':
|
||||||
|
$this->content(mt_rand(170, 250));
|
||||||
|
$this->up(mt_rand(12, 50));
|
||||||
|
break;
|
||||||
|
case '28':
|
||||||
|
$this->content(mt_rand(155, 200));
|
||||||
|
$this->up(mt_rand(5, 50));
|
||||||
|
break;
|
||||||
|
case '7':
|
||||||
|
default:
|
||||||
|
$this->content(143);
|
||||||
|
$this->up(15);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $percent
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function up($percent)
|
||||||
|
{
|
||||||
|
return $this->footer(
|
||||||
|
"<i class=\"feather icon-trending-up text-success\"></i> {$percent}% Increase"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $percent
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function down($percent)
|
||||||
|
{
|
||||||
|
return $this->footer(
|
||||||
|
"<i class=\"feather icon-trending-down text-danger\"></i> {$percent}% Decrease"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置卡片底部内容.
|
||||||
|
*
|
||||||
|
* @param string|Renderable|\Closure $footer
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function footer($footer)
|
||||||
|
{
|
||||||
|
$this->footer = $footer;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 渲染卡片内容.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function renderContent()
|
||||||
|
{
|
||||||
|
$content = parent::renderContent();
|
||||||
|
|
||||||
|
return <<<HTML
|
||||||
|
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px">
|
||||||
|
<h2 class="ml-1 font-lg-1">{$content}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="ml-1 mt-1 font-weight-bold text-80">
|
||||||
|
{$this->renderFooter()}
|
||||||
|
</div>
|
||||||
|
HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 渲染卡片底部内容.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function renderFooter()
|
||||||
|
{
|
||||||
|
return $this->toString($this->footer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Dcat\Admin\Admin;
|
||||||
|
use Dcat\Admin\Grid;
|
||||||
|
use Dcat\Admin\Form;
|
||||||
|
use Dcat\Admin\Grid\Filter;
|
||||||
|
use Dcat\Admin\Show;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dcat-admin - admin builder based on Laravel.
|
||||||
|
* @author jqh <https://github.com/jqhph>
|
||||||
|
*
|
||||||
|
* Bootstraper for Admin.
|
||||||
|
*
|
||||||
|
* Here you can remove builtin form field:
|
||||||
|
*
|
||||||
|
* extend custom field:
|
||||||
|
* Dcat\Admin\Form::extend('php', PHPEditor::class);
|
||||||
|
* Dcat\Admin\Grid\Column::extend('php', PHPEditor::class);
|
||||||
|
* Dcat\Admin\Grid\Filter::extend('php', PHPEditor::class);
|
||||||
|
*
|
||||||
|
* Or require js and css assets:
|
||||||
|
* Admin::css('/packages/prettydocs/css/styles.css');
|
||||||
|
* Admin::js('/packages/prettydocs/js/main.js');
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Routing\Router;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use Dcat\Admin\Admin;
|
||||||
|
|
||||||
|
Admin::routes();
|
||||||
|
|
||||||
|
Route::group([
|
||||||
|
'prefix' => config('admin.route.prefix'),
|
||||||
|
'namespace' => config('admin.route.namespace'),
|
||||||
|
'middleware' => config('admin.route.middleware'),
|
||||||
|
], function (Router $router) {
|
||||||
|
|
||||||
|
$router->get('/', 'HomeController@index');
|
||||||
|
$router->get('/bjdcresult', 'BjdcResultController@index');
|
||||||
|
$router->get('/shop_compare_bill', 'ShopController@compareBill');
|
||||||
|
$router->resource('/shop', ShopController::class);
|
||||||
|
|
||||||
|
$router->resource('/seller', SellerController::class);
|
||||||
|
$router->resource('/lotterytype', LotteryTypeController::class);
|
||||||
|
$router->resource('/shop_pay_channel', ShopPayChannelController::class);
|
||||||
|
$router->resource('/shop_extra', ShopExtraController::class);
|
||||||
|
$router->resource('/shop_agent', ShopAgentController::class);
|
||||||
|
$router->resource('/shop_agent_bill', ShopAgentBillController::class);
|
||||||
|
$router->resource('/shop_withdraw', ShopWithdrawController::class);
|
||||||
|
$router->resource('/shop_recharge', ShopRechargeController::class);
|
||||||
|
$router->get('/order/shopOrderMoney', 'OrderController@shopOrderMoney');
|
||||||
|
$router->get('/order_auto_fadan', 'OrderController@autoFadan');
|
||||||
|
$router->resource('/order', OrderController::class);
|
||||||
|
$router->resource('/customer', CustomerController::class);
|
||||||
|
$router->resource('/report_shop_order', ReportShopOrderController::class);
|
||||||
|
|
||||||
|
$router->resource('/pls', PlsController::class);
|
||||||
|
$router->resource('/plw', PlwController::class);
|
||||||
|
$router->resource('/qxc', QxcController::class);
|
||||||
|
$router->resource('/dlt', DltController::class);
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Enums\ClientIOSType;
|
||||||
|
use App\Enums\MaterialScene;
|
||||||
|
use App\Model\Apps;
|
||||||
|
use App\Model\Material;
|
||||||
|
use App\Utils\Helps;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class AutoRemoveLotteryFile extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'AutoRemoveLotteryFile';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '删除两个月前的lottery图片';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$month = date('Ym', strtotime('-2 months'));
|
||||||
|
$lotteryPath = MaterialScene::getDiskPathForMonth(MaterialScene::LOTTERY, $month);
|
||||||
|
|
||||||
|
$path = public_path($lotteryPath);
|
||||||
|
|
||||||
|
$fileExist = file_exists($path);
|
||||||
|
if (!$fileExist) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!is_dir($path)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$this->rrmdir($path);
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error('AutoRemoveLotteryFile remove dir error', [
|
||||||
|
'path'=> $path,
|
||||||
|
'error' => $e->getMessage()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function rrmdir($src) {
|
||||||
|
$dir = opendir($src);
|
||||||
|
while(false !== ( $file = readdir($dir)) ) {
|
||||||
|
if (( $file != '.' ) && ( $file != '..' )) {
|
||||||
|
$full = $src . '/' . $file;
|
||||||
|
if ( is_dir($full) ) {
|
||||||
|
$this->rrmdir($full);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Log::info('AutoRemoveLotteryFile remove file:' . $full);
|
||||||
|
unlink($full);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($dir);
|
||||||
|
rmdir($src);
|
||||||
|
Log::info('AutoRemoveLotteryFile remove dir:' . $src);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,107 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Dlt;
|
||||||
|
|
||||||
|
use App\Enums\BoolEnum;
|
||||||
|
use App\Enums\LottType;
|
||||||
|
use App\Model\Dlt;
|
||||||
|
use App\Model\LotteryType;
|
||||||
|
use App\Model\Lq\JclqCompetition;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use QL\QueryList;
|
||||||
|
|
||||||
|
class SyncDltIssue extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 免费数据接口
|
||||||
|
* https://www.jisuapi.com/api/caipiao/
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'dlt:sync_dlt_issue';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$cdate = date('Y-m-d H:i:s');
|
||||||
|
$dlt = Dlt::where('close_time', '>', $cdate)->where('enable', BoolEnum::YES)->first();
|
||||||
|
if ($dlt) {
|
||||||
|
Log::info('SyncDltIssue 已存在在售期号:'.$dlt->issue_num);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Log::info('SyncDltIssue开始同步大乐透的开售期号');
|
||||||
|
$url = 'https://trade.500.com/dlt/';
|
||||||
|
$con = file_get_contents($url);
|
||||||
|
$query = QueryList::setHtml($con);
|
||||||
|
$issueString = $query->find('.logo-text > .f14')->text();
|
||||||
|
$closeString = $query->find('.logo-info')->text();
|
||||||
|
$prizeString = $query->find('.logo-info > .gray > .ff-arial')->text();
|
||||||
|
|
||||||
|
preg_match('/\d+/', $issueString, $issueMat);
|
||||||
|
preg_match('/(\d{2}-\d{2}\s\d{2}:\d{2})/', $closeString, $closeMat);
|
||||||
|
|
||||||
|
$logData = [
|
||||||
|
'$issueString' => $issueString,
|
||||||
|
'$closeString' => $closeString,
|
||||||
|
'$prizeString' => $prizeString,
|
||||||
|
'$issueMat' => $issueMat,
|
||||||
|
'$closeMat' => $closeMat,
|
||||||
|
];
|
||||||
|
Log::info('SyncDltIssue 数据', $logData);
|
||||||
|
|
||||||
|
$issue = $issueMat[0];
|
||||||
|
$closeTime = $closeMat[0];
|
||||||
|
|
||||||
|
if (!$issue) {
|
||||||
|
Log::error('SyncDltIssue 获取大乐透当前期号失败');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$dlt = Dlt::where('issue_num', $issue)->first();
|
||||||
|
if ($dlt) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dlt::where('enable', BoolEnum::YES)
|
||||||
|
->where('state', BoolEnum::NO)
|
||||||
|
->update([
|
||||||
|
'enable' => BoolEnum::NO
|
||||||
|
]);
|
||||||
|
|
||||||
|
$dlt = new Dlt();
|
||||||
|
$dlt->enable = BoolEnum::YES;
|
||||||
|
$dlt->issue_num = $issue;
|
||||||
|
$dlt->prize = $prizeString;
|
||||||
|
$dlt->close_time = date('Y') . '-' . $closeTime;
|
||||||
|
$dlt->prize_time = date('Y-m-d H:i:s', strtotime($dlt->close_time) + 25 * 60);
|
||||||
|
$dlt->save();
|
||||||
|
|
||||||
|
$dltLottery = LotteryType::where('type', LottType::DLT)->first();
|
||||||
|
if ($dltLottery) {
|
||||||
|
$dltLottery->info = '奖池'.$prizeString;
|
||||||
|
$dltLottery->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Dlt;
|
||||||
|
|
||||||
|
use App\Enums\BoolEnum;
|
||||||
|
use App\Jobs\RefreshOrderDltResult;
|
||||||
|
use App\Model\Dlt;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class SyncDltResult extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'dlt:sync_dlt_result';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
Log::info('SyncDltResult 开始同步大乐透的开奖结果');
|
||||||
|
$url = 'https://trade.500.com/static/info/prizeinfo/newxml/dlt/list5.json?t=' . time();
|
||||||
|
|
||||||
|
try {
|
||||||
|
$content = file_get_contents($url);
|
||||||
|
$data = json_decode($content, true);
|
||||||
|
foreach ($data as $item) {
|
||||||
|
$dlt = Dlt::where('issue_num', $item['expect'])->first();
|
||||||
|
if ($dlt && $dlt->state == BoolEnum::YES) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!$dlt) {
|
||||||
|
$dlt = new Dlt();
|
||||||
|
}
|
||||||
|
$dlt->state = BoolEnum::YES;
|
||||||
|
$dlt->enable = BoolEnum::NO;
|
||||||
|
$dlt->issue_num = $item['expect'];
|
||||||
|
$dlt->qian = explode(',', $item['foreresult']);
|
||||||
|
$dlt->hou = explode(',', $item['backresult']);
|
||||||
|
$dlt->base1_num = $item['basenum1'];
|
||||||
|
$dlt->base2_num = $item['basenum2'];
|
||||||
|
$dlt->base3_num = $item['basenum3'];
|
||||||
|
$dlt->base1_prize = $item['basemoney1'];
|
||||||
|
$dlt->base2_prize = $item['basemoney2'];
|
||||||
|
$dlt->base3_prize = $item['basemoney3'];
|
||||||
|
$dlt->add1_num = $item['additionnum1'];
|
||||||
|
$dlt->add2_num = $item['additionnum2'];
|
||||||
|
$dlt->add3_num = $item['additionnum3'];
|
||||||
|
$dlt->add1_prize = $item['additionmoney1'];
|
||||||
|
$dlt->add2_prize = $item['additionmoney2'];
|
||||||
|
$dlt->add3_prize = $item['additionmoney3'];
|
||||||
|
$dlt->save();
|
||||||
|
|
||||||
|
// 派发任务
|
||||||
|
RefreshOrderDltResult::dispatch($dlt->id);
|
||||||
|
}
|
||||||
|
} catch (\Exception $exception) {
|
||||||
|
Log::error('SyncDltResult error:' . $exception->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,168 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Enums\LottState;
|
||||||
|
use App\Enums\OrderType;
|
||||||
|
use App\Enums\PayState;
|
||||||
|
use App\Model\Customer\Customer;
|
||||||
|
use App\Model\Customer\CustomerRanking;
|
||||||
|
use App\Model\Order;
|
||||||
|
use App\Utils\Helps;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class GenerateCustomerRanking extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'gen:customer_ranking';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '生成用户的,一站成名,七日命中率,连红榜信息';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$cdate = date('Ymd');
|
||||||
|
Customer::chunkById(100, function ($customers) use ($cdate) {
|
||||||
|
foreach ($customers as $customer) {
|
||||||
|
$this->generateRankingData($customer, $cdate);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function generateRankingData($customer, $cdate)
|
||||||
|
{
|
||||||
|
$orders = $this->last7DayOrders($customer->id);
|
||||||
|
|
||||||
|
$day7 = $this->dayxReport($orders);
|
||||||
|
|
||||||
|
if (@$day7['rank_fame'] || @$day7['rank_hit_rate'] || @$day7['rank_profit']) {
|
||||||
|
$day5 = $this->dayxReport($orders, 5);
|
||||||
|
$day3 = $this->dayxReport($orders, 3);
|
||||||
|
$day2 = $this->dayxReport($orders, 2);
|
||||||
|
|
||||||
|
$insertData = array_merge($day7, $day5, $day3, $day2);
|
||||||
|
|
||||||
|
$customerRanking = CustomerRanking::where('customer_id', $customer->id)
|
||||||
|
->where('cdate', $cdate)
|
||||||
|
->first();
|
||||||
|
if (!$customerRanking) {
|
||||||
|
$customerRanking = new CustomerRanking();
|
||||||
|
$customerRanking->cdate = $cdate;
|
||||||
|
$customerRanking->customer_id = $customer->id;
|
||||||
|
$customerRanking->shop_id = $customer->shop_id;
|
||||||
|
}
|
||||||
|
$insertData['rank_fame'] = $insertData['rank_fame']??0;
|
||||||
|
$insertData['rank_hit_rate'] = $insertData['rank_hit_rate']??0;
|
||||||
|
$insertData['rank_profit'] = $insertData['rank_profit']??0;
|
||||||
|
|
||||||
|
foreach ($insertData as $field => $val) {
|
||||||
|
$customerRanking->{$field} = $val;
|
||||||
|
}
|
||||||
|
$customerRanking->save();
|
||||||
|
|
||||||
|
$winNum = collect($orders)->whereIn('lottery_state', [LottState::WIN, LottState::SEND])->count();
|
||||||
|
$lossNum = collect($orders)->where('lottery_state', LottState::LOSS)->count();
|
||||||
|
Customer::where('id', $customer->id)
|
||||||
|
->update([
|
||||||
|
'win_alway_num' => $customerRanking->wined_max7,
|
||||||
|
'win_hit_rate' => $winNum > 0 ? ($lossNum/$winNum) * 1000 : 0,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param \Illuminate\Support\Collection|\Tightenco\Collect\Support\Collection $orderRawData
|
||||||
|
* @param $dayx
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function dayxReport($orderRawData, $dayx = 7)
|
||||||
|
{
|
||||||
|
$orders = $orderRawData->where('created_date', '>=', date('Ymd', strtotime("-{$dayx} day")));
|
||||||
|
$results = $orders->where('wined', '<>', -1);
|
||||||
|
$lastOrder = $results->first();
|
||||||
|
$dateArray = $orders->pluck('created_date')->toArray();
|
||||||
|
$resultArray = $results->where('wined', '<>', -1)->pluck('wined')->toArray();
|
||||||
|
|
||||||
|
// 最近三单连红次数
|
||||||
|
$last3Array = $orders->where('lottery_state', '<>', LottState::WAIT)->shift(3);
|
||||||
|
$last3WinArray = $last3Array->pluck('wined')->toArray();
|
||||||
|
$last3Max = Helps::findMaxConsecutive($last3WinArray, 1);
|
||||||
|
|
||||||
|
|
||||||
|
$danWinCount = $orders->where('wined', 1)->count();
|
||||||
|
$danLossCount = $orders->where('wined', 0)->count();
|
||||||
|
$danCount = $orders->count();
|
||||||
|
|
||||||
|
$dateArray = array_values(array_unique($dateArray));
|
||||||
|
$dayMax = Helps::findMaxConsecutiveDays($dateArray);
|
||||||
|
$lossMax = Helps::findMaxConsecutive($resultArray, 0);
|
||||||
|
$winMax = Helps::findMaxConsecutive($resultArray, 1);
|
||||||
|
|
||||||
|
$baseInfo = [
|
||||||
|
'total_num' . $dayx => $orders->count(),
|
||||||
|
'wined_num' . $dayx => $danWinCount,
|
||||||
|
'wined_max' . $dayx => $winMax,
|
||||||
|
'loss_max' . $dayx => $lossMax,
|
||||||
|
'loss_num' . $dayx => $danLossCount,
|
||||||
|
'total_money' . $dayx => $results->sum('money'),
|
||||||
|
'total_prize' . $dayx => $results->sum('lottery_prize'),
|
||||||
|
'last_prize' => $lastOrder ? $lastOrder->lottery_prize : 0,
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($dayx == 7) {
|
||||||
|
// 一站成名: 最后一单是红的,并且7日内有连续3天都红
|
||||||
|
if ($lastOrder && $lastOrder->wined == 1 && $lossMax < 3 && $dayMax >= 3) {
|
||||||
|
$baseInfo['rank_fame'] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 命中: 7日内发单>=4,并且至少红2单,并且7日内至少连续3日发单
|
||||||
|
if ($lossMax < 3 && $danCount >= 4 && $dayMax >= 3 ) {
|
||||||
|
$baseInfo['rank_hit_rate'] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 盈利榜: 7日内至少连续3日发单,并且最近3单至少红2单
|
||||||
|
if ($dayMax >= 3 && $last3Max >= 2) {
|
||||||
|
$baseInfo['rank_profit'] = 1;
|
||||||
|
$baseInfo['profit_lv7'] = Helps::percentage($baseInfo['total_prize'.$dayx], $baseInfo['total_money'.$dayx]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $baseInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $customerId
|
||||||
|
* @return \Illuminate\Support\Collection|\Tightenco\Collect\Support\Collection
|
||||||
|
*/
|
||||||
|
public function last7DayOrders($customerId)
|
||||||
|
{
|
||||||
|
$orders = Order::select([
|
||||||
|
'id', 'pid', 'money', 'type', 'type_mode', 'created_date', 'customer_id', 'shop_id', 'lottery_state', 'lottery_prize',
|
||||||
|
DB::raw('CASE lottery_state WHEN 3 THEN -1 WHEN 2 THEN 0 ELSE 1 END AS wined')
|
||||||
|
])
|
||||||
|
->where('customer_id', $customerId)
|
||||||
|
->where('type', OrderType::FADAN)
|
||||||
|
->where('created_date', '>=', date('Ymd', strtotime('-7 day')))
|
||||||
|
->where('pay_state', PayState::SUCCESS)
|
||||||
|
->whereIn('lottery_state', [LottState::WAIT, LottState::WIN, LottState::SEND, LottState::LOSS])
|
||||||
|
->orderBy('id', 'desc')
|
||||||
|
->get();
|
||||||
|
return $orders;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,109 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Enums\ClientIOSType;
|
||||||
|
use App\Model\Apps;
|
||||||
|
use App\Utils\Helps;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class IosIpaSign extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'ios:ipa_sign {type}';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$clientType = $this->argument('type');
|
||||||
|
$types = [ ClientIOSType::BUYER, ClientIOSType::SELLER];
|
||||||
|
if (!in_array($clientType, $types)) {
|
||||||
|
dump('type error:' . $clientType);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$outIpaPemPath = base_path('scripts/sign/ipas/'.date('Ymd'));
|
||||||
|
|
||||||
|
if (!file_exists($outIpaPemPath)) {
|
||||||
|
mkdir($outIpaPemPath,0777, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($clientType == ClientIOSType::BUYER) {
|
||||||
|
$version = Apps::buyerIOSVersion();
|
||||||
|
} else if ($clientType == ClientIOSType::SELLER) {
|
||||||
|
$version = Apps::sellerIOSVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
$uuid = 'a018277820e5eb371a8ffc5587afb3896410f40b';
|
||||||
|
$udidType = sprintf('release-%s-%s', $clientType, $version);
|
||||||
|
|
||||||
|
$provPath = $outIpaPemPath . '/'. $udidType . '.prov';
|
||||||
|
$certfPath = $outIpaPemPath . '/'. $udidType . '.certf';
|
||||||
|
|
||||||
|
if ($clientType == ClientIOSType::BUYER) {
|
||||||
|
$realIpaPath = Helps::ipaBuyerPath();
|
||||||
|
$appBundleId = 'com.pingco.daxiangzj';
|
||||||
|
} else {
|
||||||
|
$realIpaPath = Helps::ipaSellerPath();
|
||||||
|
$appBundleId = 'com.pingco.yunduoxd';
|
||||||
|
}
|
||||||
|
|
||||||
|
$shellPath = base_path('scripts/sign');
|
||||||
|
putenv('LANG=en_US.UTF-8');
|
||||||
|
|
||||||
|
$shell = "$shellPath/run.sh $appBundleId hanbin@pingco.com Zhang121748 2R4737WLD7 $uuid $shellPath/CertificateSigningRequest.certSigningRequest $provPath $certfPath";
|
||||||
|
|
||||||
|
exec($shell,$output, $outcode);
|
||||||
|
if ($outcode != 0) {
|
||||||
|
dump('生成profile文件失败', [
|
||||||
|
'code' => $outcode,
|
||||||
|
'error' => $output,
|
||||||
|
'shell' => $shell,
|
||||||
|
]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$shellOutIpaPath = $outIpaPemPath . '/' . $udidType. '.ipa';
|
||||||
|
$shellIpa = "/usr/bin/zsign -k $shellPath/kefen.pem -p yunduoxd -m $provPath -o $shellOutIpaPath -z 9 $realIpaPath 2>&1";
|
||||||
|
exec($shellIpa,$outputIpa, $outCodeIpa);
|
||||||
|
if ($outCodeIpa != 0) {
|
||||||
|
dump('签名ipa文件失败', [
|
||||||
|
'code' => $outCodeIpa,
|
||||||
|
'error' => $outputIpa,
|
||||||
|
'shell' => $shellIpa,
|
||||||
|
]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$shellMv = "mv -f $shellOutIpaPath $realIpaPath";
|
||||||
|
exec($shellMv,$outputMv, $outCodeMv);
|
||||||
|
|
||||||
|
if ($outCodeMv != 0) {
|
||||||
|
Log::error('签名ipa文件失败', [
|
||||||
|
'code' => $outCodeMv,
|
||||||
|
'error' => $outputMv,
|
||||||
|
'shell' => $shellMv,
|
||||||
|
]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dump('IosIpaSign:: ipa build succeess~~~~~~~~~~~');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Lq;
|
||||||
|
|
||||||
|
use App\Model\Lq\JclqCompetition;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class SyncCompetition extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'lq:sync_competition';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
Log::info('SyncCompetition 篮球赛事');
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$competitions = $alStatService->getLqCompetition();
|
||||||
|
if (!$competitions) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($competitions as $item) {
|
||||||
|
|
||||||
|
$competition = JclqCompetition::where('competition_id', $item['id'])->first();
|
||||||
|
if (!$competition) {
|
||||||
|
$competition = new JclqCompetition();
|
||||||
|
}
|
||||||
|
$competition->competition_id = $item['id'];
|
||||||
|
$competition->name = strval(Arr::get($item, 'name'));
|
||||||
|
$competition->name_full = strval(Arr::get($item, 'nameFull'));
|
||||||
|
$competition->name_en = strval(Arr::get($item, 'nameEn'));
|
||||||
|
$competition->name_en_full = strval(Arr::get($item, 'nameEnFull'));
|
||||||
|
$competition->competition_type = strval(Arr::get($item, 'competitionType'));
|
||||||
|
$competition->team_type = strval(Arr::get($item, 'teamType'));
|
||||||
|
$competition->gender = strval(Arr::get($item, 'gender'));
|
||||||
|
$competition->curr_season_id = intval( Arr::get($item, 'currSeasonId'));
|
||||||
|
$competition->curr_season = strval(Arr::get($item, 'currSeason'));
|
||||||
|
$competition->area_id = intval(Arr::get($item, 'areaId'));
|
||||||
|
$competition->quarter_num = intval(Arr::get($item, 'quarterNum'));
|
||||||
|
$competition->quarter_time = strval(Arr::get($item, 'quarterTime'));
|
||||||
|
$competition->colour = strval(Arr::get($item, 'colour'));
|
||||||
|
$competition->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,108 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Lq;
|
||||||
|
|
||||||
|
use App\Enums\LottType;
|
||||||
|
use App\Model\LotteryType;
|
||||||
|
use App\Model\Lq\JclqOdds;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class SyncJclqOdds extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'lq:sync_jclq_odds';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
Log::info('SyncJclqOdds 篮球赔率数据');
|
||||||
|
|
||||||
|
$this->syncOdds();
|
||||||
|
|
||||||
|
$sellingCount = JclqOdds::selling()->where('close_time', '>', date('Y-m-d H:i:s'))->count();
|
||||||
|
$lotteryType = LotteryType::withTrashed()->where('type', LottType::JCLQ)->first();
|
||||||
|
$lotteryType->info = sprintf('%d场赛事可投', $sellingCount);
|
||||||
|
$lotteryType->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function syncOdds() {
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$odds = $alStatService->getLqOdds();
|
||||||
|
if (!$odds) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($odds as $item) {
|
||||||
|
|
||||||
|
$odd = JclqOdds::where('odds_id', $item['id'])->first();
|
||||||
|
if (!$odd) {
|
||||||
|
$odd = new JclqOdds();
|
||||||
|
}
|
||||||
|
$odd->odds_id = $item['id'];
|
||||||
|
$odd->match_id = intval(Arr::get($item, 'matchId'));
|
||||||
|
$odd->issue_num = strval(Arr::get($item, 'issueNum'));
|
||||||
|
$odd->play_num = strval(Arr::get($item, 'playNum'));
|
||||||
|
$odd->jc_competition_name = strval(Arr::get($item, 'jcComptName'));
|
||||||
|
$odd->jc_competition_name_full = strval(Arr::get($item, 'jcComptNameFull'));
|
||||||
|
$odd->jc_home_team_name = strval(Arr::get($item, 'jcHomeTeamName'));
|
||||||
|
$odd->jc_home_team_name_full = strval(Arr::get($item, 'jcHomeTeamNameFull'));
|
||||||
|
$odd->jc_away_team_name = strval(Arr::get($item, 'jcAwayTeamName'));
|
||||||
|
$odd->jc_away_team_name_full = strval(Arr::get($item, 'jcAwayTeamNameFull'));
|
||||||
|
$odd->sale_state = strval(Arr::get($item, 'salesState'));
|
||||||
|
$odd->is_reverse = intval(Arr::get($item, 'isReverse'));
|
||||||
|
$odd->close_time = strval(Arr::get($item, 'closeTime'));
|
||||||
|
$odd->order_state = strval(Arr::get($item, 'orderState'));
|
||||||
|
|
||||||
|
$odd->sf_odds = Arr::get($item, 'sfOdds', []);
|
||||||
|
$odd->sf_odds_last = $this->oddsLast($odd->sf_odds_last, $odd->sf_odds);
|
||||||
|
|
||||||
|
$odd->rf_odds = Arr::get($item, 'rfOdds', []);
|
||||||
|
$odd->rf_odds_last = $this->oddsLast($odd->rf_odds_last, $odd->rf_odds);
|
||||||
|
|
||||||
|
$odd->sfc_odds = Arr::get($item, 'sfcOdds', []);
|
||||||
|
$odd->sfc_odds_last = $this->oddsLast($odd->sfc_odds_last, $odd->sfc_odds);
|
||||||
|
|
||||||
|
$odd->dxf_odds = Arr::get($item, 'dxfOdds', []);
|
||||||
|
$odd->dxf_odds_last = $this->oddsLast($odd->dxf_odds_last, $odd->dxf_odds);
|
||||||
|
|
||||||
|
$odd->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function oddsLast($fieldOldData, $fieldNewData) {
|
||||||
|
if (!$fieldOldData) {
|
||||||
|
return $fieldNewData;
|
||||||
|
}
|
||||||
|
foreach ($fieldNewData as $k => $v) {
|
||||||
|
if (Arr::get($fieldOldData, $k) != $v) {
|
||||||
|
return $fieldNewData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $fieldOldData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,108 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Lq;
|
||||||
|
|
||||||
|
use App\Jobs\RefreshOrderJclqResult;
|
||||||
|
use App\Model\Lq\JclqCompetition;
|
||||||
|
use App\Model\Lq\JclqOdds;
|
||||||
|
use App\Model\Lq\JclqResult;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class SyncJclqResult extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'lq:sync_jclq_result';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
Log::info('SyncJclqOdds 篮球开奖结果');
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$results = $alStatService->getLqResult();
|
||||||
|
if (!$results) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($results as $item) {
|
||||||
|
|
||||||
|
$id = $item['jclqOddId'];
|
||||||
|
$result = JclqResult::where('odds_id', $id)->first();
|
||||||
|
if ($result) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$issueNum = strval(Arr::get($item, 'issueNum'));
|
||||||
|
$issueNumArr = explode('/', $issueNum);
|
||||||
|
$odds = JclqOdds::where('odds_id', $id)->first();
|
||||||
|
$result = new JclqResult();
|
||||||
|
$result->jclq_odds_id = $odds ? $odds->id : 0;
|
||||||
|
$result->odds_id = $id;
|
||||||
|
$result->match_id = intval(Arr::get($item, 'matchId'));
|
||||||
|
$result->issue_num = $issueNum;
|
||||||
|
$result->issue_date = strval(Arr::get($issueNumArr, 0));
|
||||||
|
$result->play_num = intval(Arr::get($item, 'playNum'));
|
||||||
|
$result->is_reverse = intval(Arr::get($item, 'isReverse'));
|
||||||
|
$result->home_score = intval(Arr::get($item, 'homeScore'));
|
||||||
|
$result->away_score = intval(Arr::get($item, 'awayScore'));
|
||||||
|
$result->q1home_score = intval(Arr::get($item, 'q1homeScore'));
|
||||||
|
$result->q1away_score = intval(Arr::get($item, 'q1awayScore'));
|
||||||
|
$result->q2home_score = intval(Arr::get($item, 'q2homeScore'));
|
||||||
|
$result->q2away_score = intval(Arr::get($item, 'q2awayScore'));
|
||||||
|
$result->q3home_score = intval(Arr::get($item, 'q3homeScore'));
|
||||||
|
$result->q3away_score = intval(Arr::get($item, 'q3awayScore'));
|
||||||
|
$result->q4home_score = intval(Arr::get($item, 'q4homeScore'));
|
||||||
|
$result->q4away_score = intval(Arr::get($item, 'q4awayScore'));
|
||||||
|
$result->othome_score = intval(Arr::get($item, 'othomeScore'));
|
||||||
|
$result->otaway_score = intval(Arr::get($item, 'otawayScore'));
|
||||||
|
$result->lottery_state = strval(Arr::get($item, 'lottState'));
|
||||||
|
$result->lottery_time = Arr::get($item, 'lotteryTime');
|
||||||
|
|
||||||
|
$result->sf_field = strval(Arr::get($item, 'sfResult.resultField'));
|
||||||
|
$result->sf_name = strval(Arr::get($item, 'sfResult.resultName'));
|
||||||
|
$result->sf_odds = floatval(Arr::get($item, 'sfResult.resultOdds'));
|
||||||
|
|
||||||
|
$result->rf_handicap = floatval(Arr::get($item, 'rfResult.handicap'));
|
||||||
|
$result->rf_field = strval(Arr::get($item, 'rfResult.resultField'));
|
||||||
|
$result->rf_name = strval(Arr::get($item, 'rfResult.resultName'));
|
||||||
|
$result->rf_odds = floatval(Arr::get($item, 'rfResult.resultOdds'));
|
||||||
|
|
||||||
|
$result->sfc_field = strval(Arr::get($item, 'sfcResult.resultField'));
|
||||||
|
$result->sfc_name = strval(Arr::get($item, 'sfcResult.resultName'));
|
||||||
|
$result->sfc_odds = floatval(Arr::get($item, 'sfcResult.resultOdds'));
|
||||||
|
|
||||||
|
$result->dxf_total_score = floatval(Arr::get($item, 'dxfResult.totalScore'));
|
||||||
|
$result->dxf_field = strval(Arr::get($item, 'dxfResult.resultField'));
|
||||||
|
$result->dxf_name = strval(Arr::get($item, 'dxfResult.resultName'));
|
||||||
|
$result->dxf_odds = floatval(Arr::get($item, 'dxfResult.resultOdds'));
|
||||||
|
|
||||||
|
$result->save();
|
||||||
|
|
||||||
|
// 派发任务
|
||||||
|
RefreshOrderJclqResult::dispatch($result->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Lq;
|
||||||
|
|
||||||
|
use App\Enums\LottType;
|
||||||
|
use App\Model\LotteryType;
|
||||||
|
use App\Model\Lq\JclqOdds;
|
||||||
|
use App\Model\Lq\JclqScore;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class SyncJclqScore extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'lq:sync_jclq_score';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
Log::info('SyncJclqScore 篮球比分数据');
|
||||||
|
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$odds = $alStatService->getLqScore();
|
||||||
|
if (!$odds) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach ($odds as $item) {
|
||||||
|
|
||||||
|
$odd = JclqScore::where('score_id', $item['id'])->first();
|
||||||
|
if (!$odd) {
|
||||||
|
$odd = new JclqScore();
|
||||||
|
}
|
||||||
|
$odd->score_id = $item['id'];
|
||||||
|
$odd->match_id = intval(Arr::get($item, 'matchId'));
|
||||||
|
$odd->timestamp = strval(Arr::get($item, 'timeStamp'));
|
||||||
|
$odd->status = intval(Arr::get($item, 'status'));
|
||||||
|
$odd->period = intval(Arr::get($item, 'period'));
|
||||||
|
$odd->quarter_remain_time = strval(Arr::get($item, 'quarterRemainTime'));
|
||||||
|
$odd->quarter_num = intval(Arr::get($item, 'quarterNum'));
|
||||||
|
$odd->home_score = intval(Arr::get($item, 'homeScore'));
|
||||||
|
$odd->away_score = intval(Arr::get($item, 'awayScore'));
|
||||||
|
$odd->q1home_score = intval(Arr::get($item, 'q1homeScore'));
|
||||||
|
$odd->q1away_score = intval(Arr::get($item, 'q1awayScore'));
|
||||||
|
$odd->q2home_score = intval(Arr::get($item, 'q2homeScore'));
|
||||||
|
$odd->q2away_score = intval(Arr::get($item, 'q2awayScore'));
|
||||||
|
$odd->q3home_score = intval(Arr::get($item, 'q3homeScore'));
|
||||||
|
$odd->q3away_score = intval(Arr::get($item, 'q3awayScore'));
|
||||||
|
$odd->q4home_score = intval(Arr::get($item, 'q4homeScore'));
|
||||||
|
$odd->q4away_score = intval(Arr::get($item, 'q4awayScore'));
|
||||||
|
$odd->over_time_num = intval(Arr::get($item, 'overTimeNum'));
|
||||||
|
$odd->over_time_score = Arr::get($item, 'overTimeScore');
|
||||||
|
$odd->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Lq;
|
||||||
|
|
||||||
|
use App\Model\Lq\JclqCompany;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
class SyncLqCompany extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'lq:sync_lq_company';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$companies = $alStatService->getLqCompany();
|
||||||
|
if (!$companies) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($companies as $item) {
|
||||||
|
$company = JclqCompany::where('company_id', $item['id'])->first();
|
||||||
|
if (!$company) {
|
||||||
|
$company = new JclqCompany();
|
||||||
|
}
|
||||||
|
$company->company_id = $item['id'];
|
||||||
|
$company->name = strval(Arr::get($item, 'name'));
|
||||||
|
$company->country = strval(Arr::get($item, 'country'));
|
||||||
|
$company->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,135 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Lq;
|
||||||
|
|
||||||
|
use App\Model\Lq\JclqZhishuDaxiao;
|
||||||
|
use App\Model\Lq\JclqZhishuOu;
|
||||||
|
use App\Model\Lq\JclqZhishuRf;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
class SyncLqMainOdds extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'lq:sync_lq_main_odds';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$date = date('Ymd');
|
||||||
|
$mainOdds = $alStatService->getLqMainOdds();
|
||||||
|
if (!$mainOdds) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($mainOdds as $item) {
|
||||||
|
$this->syncZhiShuOu($item['matchId'],$date, Arr::get($item, 'ouzhiOdds'));
|
||||||
|
$this->syncZhiShuRf($item['matchId'], $date,Arr::get($item, 'rfOdds'));
|
||||||
|
$this->syncZhiShuDaXiao($item['matchId'],$date, Arr::get($item, 'daxiaoOdds'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function syncZhiShuOu($matchId,$date, $data) {
|
||||||
|
if (!$data) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach ($data as $item) {
|
||||||
|
$companyId = intval(Arr::get($item, 'companyId'));
|
||||||
|
$type = intval(Arr::get($item, 'type'));
|
||||||
|
$zhishu = JclqZhishuOu::where('cdate', $date)
|
||||||
|
->where('company_id', $companyId)
|
||||||
|
->where('match_id', $matchId)
|
||||||
|
->where('type', $type)
|
||||||
|
->first();
|
||||||
|
if (!$zhishu) {
|
||||||
|
$zhishu = new JclqZhishuOu();
|
||||||
|
}
|
||||||
|
$zhishu->match_id = $matchId;
|
||||||
|
$zhishu->cdate = $date;
|
||||||
|
$zhishu->company_id = $companyId;
|
||||||
|
$zhishu->type = $type;
|
||||||
|
$zhishu->win = floatval(Arr::get($item, 'win'));
|
||||||
|
$zhishu->loss = floatval(Arr::get($item, 'loss'));
|
||||||
|
$zhishu->change_time = Arr::get($item, 'changeTime');
|
||||||
|
$zhishu->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
protected function syncZhiShuRf($matchId, $date,$data) {
|
||||||
|
if (!$data) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach ($data as $item) {
|
||||||
|
$companyId = intval(Arr::get($item, 'companyId'));
|
||||||
|
$type = intval(Arr::get($item, 'type'));
|
||||||
|
$zhishu = JclqZhishuRf::where('cdate', $date)
|
||||||
|
->where('company_id', $companyId)
|
||||||
|
->where('match_id', $matchId)
|
||||||
|
->where('type', $type)
|
||||||
|
->first();
|
||||||
|
if (!$zhishu) {
|
||||||
|
$zhishu = new JclqZhishuRf();
|
||||||
|
}
|
||||||
|
$zhishu->match_id = $matchId;
|
||||||
|
$zhishu->cdate = $date;
|
||||||
|
$zhishu->company_id = $companyId;
|
||||||
|
$zhishu->type = $type;
|
||||||
|
$zhishu->handicap = floatval(Arr::get($item, 'handicap'));
|
||||||
|
$zhishu->home = floatval(Arr::get($item, 'home'));
|
||||||
|
$zhishu->away = floatval(Arr::get($item, 'away'));
|
||||||
|
$zhishu->change_time = Arr::get($item, 'changeTime');
|
||||||
|
$zhishu->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected function syncZhiShuDaXiao($matchId, $date,$data) {
|
||||||
|
if (!$data) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach ($data as $item) {
|
||||||
|
$companyId = intval(Arr::get($item, 'companyId'));
|
||||||
|
$type = intval(Arr::get($item, 'type'));
|
||||||
|
$zhishu = JclqZhishuDaxiao::where('cdate', $date)
|
||||||
|
->where('company_id', $companyId)
|
||||||
|
->where('match_id', $matchId)
|
||||||
|
->where('type', $type)
|
||||||
|
->first();
|
||||||
|
if (!$zhishu) {
|
||||||
|
$zhishu = new JclqZhishuDaxiao();
|
||||||
|
}
|
||||||
|
$zhishu->match_id = $matchId;
|
||||||
|
$zhishu->cdate = $date;
|
||||||
|
$zhishu->company_id = $companyId;
|
||||||
|
$zhishu->type = $type;
|
||||||
|
$zhishu->handicap = floatval(Arr::get($item, 'handicap'));
|
||||||
|
$zhishu->over = floatval(Arr::get($item, 'over'));
|
||||||
|
$zhishu->under = floatval(Arr::get($item, 'under'));
|
||||||
|
$zhishu->change_time = Arr::get($item, 'changeTime');
|
||||||
|
$zhishu->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,107 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Lq;
|
||||||
|
|
||||||
|
use App\Model\Lq\JclqCompany;
|
||||||
|
use App\Model\Lq\JclqCompetition;
|
||||||
|
use App\Model\Lq\JclqMatch;
|
||||||
|
use App\Model\Lq\JclqSeason;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
class SyncLqMatch extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'lq:sync_lq_match';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
JclqSeason::select(['id', 'season_id'])
|
||||||
|
->chunkById(500, function ($seasons) {
|
||||||
|
foreach ($seasons as $season) {
|
||||||
|
$this->syncMatch($season->season_id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function syncMatch($seasonId)
|
||||||
|
{
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$matches = $alStatService->getLqMatch($seasonId);
|
||||||
|
if (!$matches) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($matches as $item) {
|
||||||
|
$match =JclqMatch::withTrashed()->select('id')->where('match_id', $item['id'])->first();
|
||||||
|
if (!$match) {
|
||||||
|
$match = new JclqMatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
$match->match_id = $item['id'];
|
||||||
|
$match->season_id = intval(Arr::get($item, 'seasonId'));
|
||||||
|
$match->competition_id = intval(Arr::get($item, 'competitionId'));
|
||||||
|
$match->competition_name = strval(Arr::get($item, 'competitionName'));
|
||||||
|
$match->season = strval(Arr::get($item, 'season'));
|
||||||
|
$match->stage_id = intval(Arr::get($item, 'stageId'));
|
||||||
|
$match->stage_name = strval(Arr::get($item, 'stageName'));
|
||||||
|
$match->group_id = intval(Arr::get($item, 'groupId'));
|
||||||
|
$match->group_name = strval(Arr::get($item, 'groupName'));
|
||||||
|
$match->playoff_id = intval(Arr::get($item, 'playoffId'));
|
||||||
|
$match->round_num = intval(Arr::get($item, 'roundNum'));
|
||||||
|
$match->start_time = Arr::get($item, 'startTime');
|
||||||
|
$match->home_team_id = intval(Arr::get($item, 'homeTeamId'));
|
||||||
|
$match->home_team_name = strval(Arr::get($item, 'homeTeamName'));
|
||||||
|
$match->away_team_id = intval(Arr::get($item, 'awayTeamId'));
|
||||||
|
$match->away_team_name = strval(Arr::get($item, 'awayTeamName'));
|
||||||
|
$match->status = intval(Arr::get($item, 'status'));
|
||||||
|
$match->quarter_num = intval(Arr::get($item, 'quarterNum'));
|
||||||
|
$match->home_score = intval(Arr::get($item, 'homeScore'));
|
||||||
|
$match->away_score = intval(Arr::get($item, 'awayScore'));
|
||||||
|
$match->q1home_score = intval(Arr::get($item, 'q1homeScore'));
|
||||||
|
$match->q1away_score = intval(Arr::get($item, 'q1awayScore'));
|
||||||
|
$match->q2home_score = intval(Arr::get($item, 'q2homeScore'));
|
||||||
|
$match->q2away_score = intval(Arr::get($item, 'q2awayScore'));
|
||||||
|
$match->q3home_score = intval(Arr::get($item, 'q3homeScore'));
|
||||||
|
$match->q3away_score = intval(Arr::get($item, 'q3awayScore'));
|
||||||
|
$match->q4home_score = intval(Arr::get($item, 'q4homeScore'));
|
||||||
|
$match->q4away_score = intval(Arr::get($item, 'q4awayScore'));
|
||||||
|
$match->over_time_num = intval(Arr::get($item, 'overTimeNum'));
|
||||||
|
|
||||||
|
$overTimeScore = [];
|
||||||
|
if (Arr::get($item, 'overTimeScore')) {
|
||||||
|
$overTimeScore = Arr::get($item, 'overTimeScore');
|
||||||
|
}
|
||||||
|
$match->ot1_home_score = intval(Arr::get($overTimeScore, 'ot1homeScore'));
|
||||||
|
$match->ot1_away_score = intval(Arr::get($overTimeScore, 'ot1awayScore'));
|
||||||
|
$match->win_team_id = intval(Arr::get($item, 'winTeamId'));
|
||||||
|
$match->is_neutral = intval(Arr::get($item, 'isNeutral'));
|
||||||
|
$match->venue_id = intval(Arr::get($item, 'venueId'));
|
||||||
|
$match->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Lq;
|
||||||
|
|
||||||
|
use App\Model\Lq\JclqMatch;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class SyncLqMatchChange extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'lq:sync_lq_match_change';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
const TYPE_DELETE = 'delete';
|
||||||
|
const TYPE_MODIFY = 'modify';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$matches = $alStatService->getLqMatchChange();
|
||||||
|
if (!$matches) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach ($matches as $item) {
|
||||||
|
$matchId = $item['matchId'];
|
||||||
|
$type = Arr::get($item, 'type');
|
||||||
|
if (!in_array($type, [self::TYPE_DELETE, self::TYPE_MODIFY])) {
|
||||||
|
Log::error('SyncLqMatchChange 未知的modify type类型', $item);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type == self::TYPE_DELETE) {
|
||||||
|
$match = JclqMatch::withTrashed()->where('match_id', $matchId)->first();
|
||||||
|
if (!$match) {
|
||||||
|
Log::error('SyncLqMatchChange withTrashed比赛id不存在', $item);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!$match->trashed()) {
|
||||||
|
$match->delete();
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$match = JclqMatch::where('match_id', $matchId)->first();
|
||||||
|
if (!$match) {
|
||||||
|
Log::error('SyncLqMatchChange 比赛id不存在', $item);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$match->status = intval(Arr::get($item, 'matchStatus'));
|
||||||
|
$match->start_time = Arr::get($item, 'matchStartTime', null);
|
||||||
|
$match->home_team_id = intval(Arr::get($item, 'homeTeamId'));
|
||||||
|
$match->away_team_id = intval(Arr::get($item, 'awayTeamId'));
|
||||||
|
$match->home_team_name = strval(Arr::get($item, 'homeTeamName'));
|
||||||
|
$match->away_team_name = strval(Arr::get($item, 'awayTeamName'));
|
||||||
|
|
||||||
|
$match->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Lq;
|
||||||
|
|
||||||
|
use App\Model\Lq\JclqCompany;
|
||||||
|
use App\Model\Lq\JclqCompetition;
|
||||||
|
use App\Model\Lq\JclqSeason;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
class SyncLqSeason extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'lq:sync_lq_season';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
JclqCompetition::select(['id', 'competition_id'])
|
||||||
|
->chunkById(500, function ($competitions) {
|
||||||
|
foreach ($competitions as $competition) {
|
||||||
|
$this->syncSeason($competition->competition_id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function syncSeason($competitionId)
|
||||||
|
{
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$seasons = $alStatService->getLqSeason($competitionId);
|
||||||
|
if (!$seasons) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($seasons as $item) {
|
||||||
|
$season = JclqSeason::where('season_id', $item['id'])->first();
|
||||||
|
if (!$season) {
|
||||||
|
$season = new JclqSeason();
|
||||||
|
}
|
||||||
|
$season->season_id = $item['id'];
|
||||||
|
$season->competition_id = intval(Arr::get($item, 'competitionId'));
|
||||||
|
$season->season = strval(Arr::get($item, 'season'));
|
||||||
|
$season->start_date = strval( Arr::get($item, 'startDate'));
|
||||||
|
$season->end_date = strval(Arr::get($item, 'endDate'));
|
||||||
|
$season->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Order;
|
||||||
|
|
||||||
|
use App\Enums\LottState;
|
||||||
|
use App\Enums\PayState;
|
||||||
|
use App\Exceptions\JingCaiException;
|
||||||
|
use App\Model\Order;
|
||||||
|
use App\Model\Seller\Seller;
|
||||||
|
use App\Service\CustomerWalletService;
|
||||||
|
use App\Utils\Helps;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use PhpMyAdmin\Logging;
|
||||||
|
|
||||||
|
class AutoDelete45 extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'order:auto_delete45';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '系统自动删除45天之前的订单数据';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$dayPoint = date('Y-m-d H:i:s', strtotime('-45 day'));
|
||||||
|
$effect = Order::where('created_at', '<=', $dayPoint)
|
||||||
|
->delete();
|
||||||
|
Log::info('AutoDelete45 删除' . $dayPoint . '之前的订单数据, 影响行数:' . $effect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Order;
|
||||||
|
|
||||||
|
use App\Enums\LottState;
|
||||||
|
use App\Enums\PayState;
|
||||||
|
use App\Exceptions\JingCaiException;
|
||||||
|
use App\Model\Order;
|
||||||
|
use App\Model\Seller\Seller;
|
||||||
|
use App\Service\CustomerWalletService;
|
||||||
|
use App\Utils\Helps;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class CancelRefund extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'order:cancel_refund';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
Log::info('CancelRefund取消订单并退款');
|
||||||
|
$closeDate = date('Y-m-d H:i:s', time() - 10 * 60);
|
||||||
|
Order::where('pay_state', PayState::SUCCESS)
|
||||||
|
->whereIn('lottery_state', [LottState::PENDING,LottState::DRAFT])
|
||||||
|
->where('odds_close_time', '<', $closeDate)
|
||||||
|
->where(function($query) {
|
||||||
|
$query->where('pid', 0)
|
||||||
|
->orWhereRaw('id=pid') // 合买
|
||||||
|
->orWhereRaw('id!=pid and type=4'); // 跟单
|
||||||
|
})
|
||||||
|
->chunkById(200, function($orders) {
|
||||||
|
|
||||||
|
foreach ($orders as $order) {
|
||||||
|
$this->cancelAndRefund($order);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function cancelAndRefund(Order $order) {
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
$order->lottery_state = LottState::CANCEL;
|
||||||
|
$order->save();
|
||||||
|
|
||||||
|
$seller = new Seller();
|
||||||
|
$seller->id = 0;
|
||||||
|
CustomerWalletService::refundForRevokeOrder($order, $seller);
|
||||||
|
DB::commit();
|
||||||
|
} catch (JingCaiException $exception) {
|
||||||
|
DB::rollBack();
|
||||||
|
Log::error('cancelAndRefund-JingCaiException', [
|
||||||
|
'order_id' => $order->id,
|
||||||
|
'error' => $exception->getMessage(),
|
||||||
|
'track' => Helps::filterStackTrace($exception->getTrace(),1)
|
||||||
|
]);
|
||||||
|
} catch (\Exception $exception) {
|
||||||
|
DB::rollBack();
|
||||||
|
Log::error('cancelAndRefund-Exception', [
|
||||||
|
'order_id' => $order->id,
|
||||||
|
'error' => $exception->getMessage(),
|
||||||
|
'track' => Helps::filterStackTrace($exception->getTrace(),2)
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Order;
|
||||||
|
|
||||||
|
use App\Enums\LottState;
|
||||||
|
use App\Enums\PayState;
|
||||||
|
use App\Model\Order;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class DeleteUnpay extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'order:delete_unpay';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
Log::info('DeleteUnpay删除未支付的订单');
|
||||||
|
|
||||||
|
$closeDate = date('Y-m-d H:i:s', strtotime('-2 day'));
|
||||||
|
|
||||||
|
Order::where('pay_state', PayState::UNPAID)
|
||||||
|
->where('odds_early_close_time', '<', $closeDate)
|
||||||
|
->chunkById(200, function($orders) {
|
||||||
|
foreach ($orders as $order) {
|
||||||
|
$order->lottery_state = LottState::DELETE;
|
||||||
|
$order->delete();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Pls;
|
||||||
|
|
||||||
|
use App\Enums\BoolEnum;
|
||||||
|
use App\Model\Pls;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use QL\QueryList;
|
||||||
|
|
||||||
|
class SyncPlsIssue extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'pls:sync_pls_issue';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$cdate = date('Y-m-d H:i:s');
|
||||||
|
$pls = Pls::where('close_time', '>', $cdate)->where('enable', BoolEnum::YES)->first();
|
||||||
|
if ($pls) {
|
||||||
|
Log::info('SyncPlsIssue 已存在在售期号:'.$pls->issue_num);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Log::info('SyncPlsIssue 开始同步排列三的开售期号');
|
||||||
|
$url = 'https://trade.500.com/pls/';
|
||||||
|
$con = file_get_contents($url);
|
||||||
|
$query = QueryList::setHtml($con);
|
||||||
|
$issueString = $query->find('.logo-text > .f14')->text();
|
||||||
|
$closeString = $query->find('.logo-info')->text();
|
||||||
|
|
||||||
|
preg_match('/\d+/', $issueString, $issueMat);
|
||||||
|
preg_match('/(\d{2}-\d{2}\s\d{2}:\d{2})/', $closeString, $closeMat);
|
||||||
|
|
||||||
|
$logData = [
|
||||||
|
'$issueString' => $issueString,
|
||||||
|
'$closeString' => $closeString,
|
||||||
|
'$issueMat' => $issueMat,
|
||||||
|
'$closeMat' => $closeMat,
|
||||||
|
];
|
||||||
|
Log::info('SyncPlsIssue 数据', $logData);
|
||||||
|
|
||||||
|
$issue = $issueMat[0];
|
||||||
|
$closeTime = $closeMat[0];
|
||||||
|
|
||||||
|
if (!$issue) {
|
||||||
|
Log::error('SyncPlsIssue 获取排列三当前期号失败');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pls = Pls::where('issue_num', $issue)->first();
|
||||||
|
if ($pls) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pls::where('enable', BoolEnum::YES)
|
||||||
|
->where('state', BoolEnum::NO)
|
||||||
|
->update([
|
||||||
|
'enable' => BoolEnum::NO
|
||||||
|
]);
|
||||||
|
|
||||||
|
$pls = new Pls();
|
||||||
|
$pls->enable = BoolEnum::YES;
|
||||||
|
$pls->issue_num = $issue;
|
||||||
|
$pls->close_time = date('Y') . '-' . $closeTime;
|
||||||
|
$pls->prize_time = date('Y-m-d H:i:s', strtotime($pls->close_time) + 25 * 60);
|
||||||
|
$pls->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Pls;
|
||||||
|
|
||||||
|
use App\Enums\BoolEnum;
|
||||||
|
use App\Jobs\RefreshOrderPlsResult;
|
||||||
|
use App\Model\Pls;
|
||||||
|
use App\Utils\Helps;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class SyncPlsResult extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'pls:sync_pls_result';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
Log::info('SyncPlsResult 开始同步排列三的开奖结果');
|
||||||
|
// $url = 'https://trade.500.com/static/info/prizeinfo/newxml/pls/list5.json';
|
||||||
|
$url = 'https://trade.500.com/static/info/prizeinfo/newxml/pls/lastPrize.xml?t=' . time();
|
||||||
|
|
||||||
|
try {
|
||||||
|
$content = file_get_contents($url);
|
||||||
|
$data = Helps::xml2json($content);
|
||||||
|
$pls = Pls::where('issue_num', $data['PeriodicalNO'])->first();
|
||||||
|
|
||||||
|
if ($data['ZhixuanMoney'] <= 0 || $data['Zuxuan3Money'] <= 0 || $data['Zuxuan6Money'] <= 0) {
|
||||||
|
Log::error('SyncPlsResult 未获取到奖金', $data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($pls && $pls->state == BoolEnum::YES) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!$pls) {
|
||||||
|
$pls = new Pls();
|
||||||
|
}
|
||||||
|
$pls->state = BoolEnum::YES;
|
||||||
|
$pls->enable = BoolEnum::NO;
|
||||||
|
$pls->issue_num = $data['PeriodicalNO'];
|
||||||
|
$pls->result = explode(',', $data['OutBall']);
|
||||||
|
$pls->prize = $data['TotalMoney'];
|
||||||
|
$pls->zhixuan_num = $data['ZhixuanNum'];
|
||||||
|
$pls->zuxuan3_num = $data['Zuxuan3Num'];
|
||||||
|
$pls->zuxuan6_num = $data['Zuxuan6Num'];
|
||||||
|
$pls->zhixuan_prize = $data['ZhixuanMoney'];
|
||||||
|
$pls->zhixuan_total_prize = $data['ZhixuanTotalMoney'];
|
||||||
|
$pls->zuxuan3_prize = $data['Zuxuan3Money'];
|
||||||
|
$pls->zuxuan3_total_prize = $data['Zuxuan3TotalMoney'];
|
||||||
|
$pls->zuxuan6_prize = $data['Zuxuan6Money'];
|
||||||
|
$pls->zuxuan6_total_prize = $data['Zuxuan6TotalMoney'];
|
||||||
|
$pls->daxiao = $data['daxiao'];
|
||||||
|
$pls->jiou = $data['jiou'];
|
||||||
|
$pls->zhihe = $data['zhihe'];
|
||||||
|
$pls->hezhi = $data['hezhi'];
|
||||||
|
$pls->kuadu = $data['kuadu'];
|
||||||
|
if (isset($data['ResultTime'])) {
|
||||||
|
$pls->prize_time = $data['ResultTime'];
|
||||||
|
}
|
||||||
|
$pls->save();
|
||||||
|
|
||||||
|
RefreshOrderPlsResult::dispatch($pls->id);
|
||||||
|
|
||||||
|
} catch (\Exception $exception) {
|
||||||
|
Log::error('SyncPlsResult error:' . $exception->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Plw;
|
||||||
|
|
||||||
|
use App\Enums\BoolEnum;
|
||||||
|
use App\Model\Plw;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use QL\QueryList;
|
||||||
|
|
||||||
|
class SyncPlwIssue extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'plw:sync_plw_issue';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$cdate = date('Y-m-d H:i:s');
|
||||||
|
$plw = Plw::where('close_time', '>', $cdate)->where('enable', BoolEnum::YES)->first();
|
||||||
|
if ($plw) {
|
||||||
|
Log::info('SyncPlwIssue 已存在在售期号:'.$plw->issue_num);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Log::info('SyncPlwIssue 开始同步排列三的开售期号');
|
||||||
|
$url = 'https://trade.500.com/plw/';
|
||||||
|
$con = file_get_contents($url);
|
||||||
|
$query = QueryList::setHtml($con);
|
||||||
|
$issueString = $query->find('.logo-text > .f14')->text();
|
||||||
|
$closeString = $query->find('.logo-info')->text();
|
||||||
|
|
||||||
|
preg_match('/\d+/', $issueString, $issueMat);
|
||||||
|
preg_match('/(\d{2}-\d{2}\s\d{2}:\d{2})/', $closeString, $closeMat);
|
||||||
|
|
||||||
|
$logData = [
|
||||||
|
'$issueString' => $issueString,
|
||||||
|
'$closeString' => $closeString,
|
||||||
|
'$issueMat' => $issueMat,
|
||||||
|
'$closeMat' => $closeMat,
|
||||||
|
];
|
||||||
|
Log::info('SyncPlwIssue 数据', $logData);
|
||||||
|
|
||||||
|
$issue = $issueMat[0];
|
||||||
|
$closeTime = $closeMat[0];
|
||||||
|
|
||||||
|
if (!$issue) {
|
||||||
|
Log::error('SyncPlwIssue 获取排列三当前期号失败');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$plw = Plw::where('issue_num', $issue)->first();
|
||||||
|
if ($plw) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Plw::where('enable', BoolEnum::YES)
|
||||||
|
->where('state', BoolEnum::NO)
|
||||||
|
->update([
|
||||||
|
'enable' => BoolEnum::NO
|
||||||
|
]);
|
||||||
|
|
||||||
|
$plw = new Plw();
|
||||||
|
$plw->enable = BoolEnum::YES;
|
||||||
|
$plw->issue_num = $issue;
|
||||||
|
$plw->close_time = date('Y') . '-' . $closeTime;
|
||||||
|
$plw->prize_time = date('Y-m-d H:i:s', strtotime($plw->close_time) + 25 * 60);
|
||||||
|
$plw->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Plw;
|
||||||
|
|
||||||
|
use App\Enums\BoolEnum;
|
||||||
|
use App\Jobs\RefreshOrderPlwResult;
|
||||||
|
use App\Model\Plw;
|
||||||
|
use App\Utils\Helps;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class SyncPlwResult extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'plw:sync_plw_result';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
Log::info('SyncPlwResult 开始同步排列五的开奖结果');
|
||||||
|
$url = 'https://trade.500.com/static/info/prizeinfo/newxml/plw/list5.json?t=' . time();
|
||||||
|
// $url = 'https://trade.500.com/static/info/prizeinfo/newxml/plw/lastPrize.xml';
|
||||||
|
|
||||||
|
try {
|
||||||
|
$content = file_get_contents($url);
|
||||||
|
$data = json_decode($content, true);
|
||||||
|
foreach ($data as $item) {
|
||||||
|
$plw = Plw::where('issue_num', $item['expect'])->first();
|
||||||
|
if ($plw && $plw->state == BoolEnum::YES) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!$plw) {
|
||||||
|
$plw = new Plw();
|
||||||
|
}
|
||||||
|
$plw->state = BoolEnum::YES;
|
||||||
|
$plw->enable = BoolEnum::NO;
|
||||||
|
$plw->issue_num = $item['expect'];
|
||||||
|
$plw->result = explode(',', $item['foreresult']);
|
||||||
|
$plw->prize = $item['basemoney1'];
|
||||||
|
$plw->save();
|
||||||
|
|
||||||
|
// 派发任务
|
||||||
|
RefreshOrderPlwResult::dispatch($plw->id);
|
||||||
|
}
|
||||||
|
} catch (\Exception $exception) {
|
||||||
|
Log::error('SyncPlwResult error:' . $exception->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Qxc;
|
||||||
|
|
||||||
|
use App\Enums\BoolEnum;
|
||||||
|
use App\Model\Qxc;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use QL\QueryList;
|
||||||
|
|
||||||
|
class SyncQxcIssue extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 免费数据接口
|
||||||
|
* https://www.jisuapi.com/api/caipiao/
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'qxc:sync_qxc_issue';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$cdate = date('Y-m-d H:i:s');
|
||||||
|
$dlt = Qxc::where('close_time', '>', $cdate)->where('enable', BoolEnum::YES)->first();
|
||||||
|
if ($dlt) {
|
||||||
|
Log::info('SyncQxcIssue 已存在在售期号:'.$dlt->issue_num);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Log::info('SyncQxcIssue开始同步七星彩的开售期号');
|
||||||
|
$url = 'https://trade.500.com/qxc/';
|
||||||
|
$con = file_get_contents($url);
|
||||||
|
$query = QueryList::setHtml($con);
|
||||||
|
$issueString = $query->find('.logo-text > .f14')->text();
|
||||||
|
$closeString = $query->find('.logo-info')->text();
|
||||||
|
$prizeString = $query->find('.logo-info .red')->text();
|
||||||
|
|
||||||
|
preg_match('/\d+/', $issueString, $issueMat);
|
||||||
|
preg_match('/(\d{2}-\d{2}\s\d{2}:\d{2})/', $closeString, $closeMat);
|
||||||
|
|
||||||
|
$logData = [
|
||||||
|
'$issueString' => $issueString,
|
||||||
|
'$closeString' => $closeString,
|
||||||
|
'$prizeString' => $prizeString,
|
||||||
|
'$issueMat' => $issueMat,
|
||||||
|
'$closeMat' => $closeMat,
|
||||||
|
];
|
||||||
|
Log::info('SyncQxcIssue 数据', $logData);
|
||||||
|
|
||||||
|
$issue = $issueMat[0];
|
||||||
|
$closeTime = $closeMat[0];
|
||||||
|
|
||||||
|
if (!$issue) {
|
||||||
|
Log::error('SyncQxcIssue 获取七星彩当前期号失败');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$dlt = Qxc::where('issue_num', $issue)->first();
|
||||||
|
if ($dlt) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Qxc::where('enable', BoolEnum::YES)
|
||||||
|
->where('state', BoolEnum::NO)
|
||||||
|
->update([
|
||||||
|
'enable' => BoolEnum::NO
|
||||||
|
]);
|
||||||
|
|
||||||
|
$dlt = new Qxc();
|
||||||
|
$dlt->enable = BoolEnum::YES;
|
||||||
|
$dlt->issue_num = $issue;
|
||||||
|
$dlt->prize = $prizeString;
|
||||||
|
$dlt->close_time = date('Y') . '-' . $closeTime;
|
||||||
|
$dlt->prize_time = date('Y-m-d H:i:s', strtotime($dlt->close_time) + 25 * 60);
|
||||||
|
$dlt->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Qxc;
|
||||||
|
|
||||||
|
use App\Enums\BoolEnum;
|
||||||
|
use App\Jobs\RefreshOrderQxcResult;
|
||||||
|
use App\Model\Qxc;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class SyncQxcResult extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'qxc:sync_qxc_result';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
Log::info('SyncQxcResult 开始同步七星彩的开奖结果');
|
||||||
|
$url = 'https://trade.500.com/static/info/prizeinfo/newxml/qx/list5.json?t=' . time();
|
||||||
|
|
||||||
|
try {
|
||||||
|
$content = file_get_contents($url);
|
||||||
|
$data = json_decode($content, true);
|
||||||
|
foreach ($data as $item) {
|
||||||
|
$qxc = Qxc::where('issue_num', $item['expect'])->first();
|
||||||
|
if ($qxc && $qxc->state == BoolEnum::YES) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!$qxc) {
|
||||||
|
$qxc = new Qxc();
|
||||||
|
}
|
||||||
|
$qxc->state = BoolEnum::YES;
|
||||||
|
$qxc->enable = BoolEnum::NO;
|
||||||
|
$qxc->issue_num = $item['expect'];
|
||||||
|
$qxc->result = explode(',', $item['foreresult']);
|
||||||
|
$qxc->base1_num = $item['basenum1'];
|
||||||
|
$qxc->base2_num = $item['basenum2'];
|
||||||
|
$qxc->base3_num = $item['basenum3'];
|
||||||
|
$qxc->base1_prize = $item['basemoney1'];
|
||||||
|
$qxc->base2_prize = $item['basemoney2'];
|
||||||
|
$qxc->base3_prize = $item['basemoney3'];
|
||||||
|
$qxc->save();
|
||||||
|
|
||||||
|
// 派发任务
|
||||||
|
RefreshOrderQxcResult::dispatch($qxc->id);
|
||||||
|
}
|
||||||
|
} catch (\Exception $exception) {
|
||||||
|
Log::error('SyncQxcResult error:' . $exception->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Report;
|
||||||
|
|
||||||
|
use App\Model\Order;
|
||||||
|
use App\Model\Report\ReportDaySeller;
|
||||||
|
use App\Model\Seller\Seller;
|
||||||
|
use App\Model\Seller\ShopBill;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
class GenerateDaySeller extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'report:generate_day_seller {cdate?}';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$cdate = $this->argument('cdate');
|
||||||
|
if (!$cdate) {
|
||||||
|
$cdate = date('Ymd', strtotime('-1 day'));
|
||||||
|
}
|
||||||
|
|
||||||
|
Seller::chunkById(500, function ($sellers) use ($cdate) {
|
||||||
|
foreach ($sellers as $seller) {
|
||||||
|
$this->report($seller, $cdate);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function report(Seller $seller, $cdate)
|
||||||
|
{
|
||||||
|
$chupiaoMoney = Order::usable()
|
||||||
|
->where('draft_date', $cdate)
|
||||||
|
->where('draft_user_id', $seller->id)
|
||||||
|
->sum('money');
|
||||||
|
|
||||||
|
$sendMoney = Order::usable()
|
||||||
|
->where('send_date', $cdate)
|
||||||
|
->where('send_user_id', $seller->id)
|
||||||
|
->sum('lottery_send_prize');
|
||||||
|
|
||||||
|
$winMoney = Order::usable()
|
||||||
|
->where('draft_date', $cdate)
|
||||||
|
->where('draft_user_id', $seller->id)
|
||||||
|
->sum('lottery_should_send_prize');
|
||||||
|
|
||||||
|
$incrMoney = ShopBill::where('created_date', $cdate)
|
||||||
|
->where('type', ShopBill::TYPE_SELLER_INCR)
|
||||||
|
->where('seller_id', $seller->id)
|
||||||
|
->sum('money');
|
||||||
|
|
||||||
|
$reduceMoney = ShopBill::where('created_date', $cdate)
|
||||||
|
->where('type', ShopBill::TYPE_SELLER_REDUCE)
|
||||||
|
->where('seller_id', $seller->id)
|
||||||
|
->sum('money');
|
||||||
|
|
||||||
|
$report = ReportDaySeller::where('seller_id', $seller->id)
|
||||||
|
->where('cdate', $cdate)
|
||||||
|
->first();
|
||||||
|
if (!$report) {
|
||||||
|
$report = new ReportDaySeller();
|
||||||
|
}
|
||||||
|
$report->seller_id = $seller->id;
|
||||||
|
$report->shop_id = $seller->shop_id;
|
||||||
|
$report->cdate = $cdate;
|
||||||
|
$report->chupiao_money = $chupiaoMoney;
|
||||||
|
$report->send_prize = $sendMoney;
|
||||||
|
$report->win_prize = $winMoney;
|
||||||
|
$report->incr_money = $incrMoney;
|
||||||
|
$report->reduce_money = $reduceMoney;
|
||||||
|
$report->save();
|
||||||
|
return $report;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,156 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Report;
|
||||||
|
|
||||||
|
use App\Enums\BillType;
|
||||||
|
use App\Enums\PayState;
|
||||||
|
use App\Enums\WithdrawState;
|
||||||
|
use App\Model\Customer\Customer;
|
||||||
|
use App\Model\Customer\CustomerBill;
|
||||||
|
use App\Model\Customer\CustomerWithdraw;
|
||||||
|
use App\Model\Order;
|
||||||
|
use App\Model\Report\ReportDaySeller;
|
||||||
|
use App\Model\Report\ReportDayShop;
|
||||||
|
use App\Model\Seller\Seller;
|
||||||
|
use App\Model\Seller\Shop;
|
||||||
|
use App\Model\Seller\ShopBill;
|
||||||
|
use App\Model\Seller\ShopCooperateBill;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class GenerateDayShop extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'report:generate_day_shop {cdate?}';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$cdate = $this->argument('cdate');
|
||||||
|
if (!$cdate) {
|
||||||
|
$cdate = date('Ymd', strtotime('-1 day'));
|
||||||
|
}
|
||||||
|
|
||||||
|
Shop::chunkById(500, function ($shops) use ($cdate) {
|
||||||
|
foreach ($shops as $shop) {
|
||||||
|
$this->report($shop, $cdate);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function report(Shop $shop, $cdate)
|
||||||
|
{
|
||||||
|
$chupiaoMoney = Order::usable()
|
||||||
|
->where('draft_date', $cdate)
|
||||||
|
->where('draft_shop_id', $shop->id)
|
||||||
|
->sum('money');
|
||||||
|
|
||||||
|
$sendMoney = Order::usable()
|
||||||
|
->where('send_date', $cdate)
|
||||||
|
->where('draft_shop_id', $shop->id)
|
||||||
|
->sum('lottery_send_prize');
|
||||||
|
|
||||||
|
$winMoney = Order::usable()
|
||||||
|
->where('draft_date', $cdate)
|
||||||
|
->where('draft_shop_id', $shop->id)
|
||||||
|
->sum('lottery_should_send_prize');
|
||||||
|
|
||||||
|
$withDraw = CustomerWithdraw::where('shop_id', $shop->id)
|
||||||
|
->where('created_at', 'like', '%' . date('Y-m-d', strtotime($cdate)) . '%')
|
||||||
|
->where('state', WithdrawState::SUCCESS)
|
||||||
|
->sum('money');
|
||||||
|
|
||||||
|
$registerNum = Customer::where('shop_id', $shop->id)
|
||||||
|
->where('created_at', '>=', date('Y-m-d 00:00:00'))
|
||||||
|
->where('created_at', '<=', date('Y-m-d 23:59:59'))
|
||||||
|
->count();
|
||||||
|
|
||||||
|
$buyerNum = Order::select(['customer_id', DB::raw('count(*)')])
|
||||||
|
->usable()
|
||||||
|
->where('created_date', $cdate)
|
||||||
|
->where('shop_id', $shop->id)
|
||||||
|
->where('pay_state', PayState::SUCCESS)
|
||||||
|
->groupBy('customer_id')
|
||||||
|
->get()
|
||||||
|
->count();
|
||||||
|
|
||||||
|
$cooperateBrokerage = ShopCooperateBill::where('seller_shop_id', $shop->id)
|
||||||
|
->where('type', ShopCooperateBill::TYPE_TICKET)
|
||||||
|
->where('created_date', $cdate)
|
||||||
|
->sum('cooperate_brokerage');
|
||||||
|
|
||||||
|
$customerRecharge = CustomerBill::leftJoin('customer', 'customer.id', 'customer_bill.customer_id')
|
||||||
|
->where('customer_bill.created_date', $cdate)
|
||||||
|
->where('customer_bill.type', BillType::RECHARGE)
|
||||||
|
->where('customer.shop_id', $shop->id)
|
||||||
|
->sum('customer_bill.money');
|
||||||
|
|
||||||
|
$shopBalance = $shop->balance;
|
||||||
|
$customersBalance = Customer::where('shop_id', $shop->id)->sum('balance');
|
||||||
|
|
||||||
|
$chupiao_fee_money = ShopBill::where('created_date', $cdate)
|
||||||
|
->where('shop_id', $shop->id)
|
||||||
|
->where('type', ShopBill::TYPE_FEE)
|
||||||
|
->sum('money');
|
||||||
|
|
||||||
|
$sellerIds = Seller::where('shop_id', $shop->id)->pluck('id')->toArray();
|
||||||
|
$incrMoney = 0;
|
||||||
|
$reduceMoney = 0;
|
||||||
|
if ($sellerIds) {
|
||||||
|
$incrMoney = CustomerBill::where('created_date', $cdate)
|
||||||
|
->where('type', BillType::SELLER_INCR)
|
||||||
|
->whereIn('seller_id', $sellerIds)
|
||||||
|
->sum('money');
|
||||||
|
|
||||||
|
$reduceMoney = CustomerBill::where('created_date', $cdate)
|
||||||
|
->where('type', BillType::SELLER_REDUCE)
|
||||||
|
->whereIn('seller_id', $sellerIds)
|
||||||
|
->sum('money');
|
||||||
|
}
|
||||||
|
|
||||||
|
$report = ReportDayShop::where('shop_id', $shop->id)
|
||||||
|
->where('cdate', $cdate)
|
||||||
|
->first();
|
||||||
|
if (!$report) {
|
||||||
|
$report = new ReportDayShop();
|
||||||
|
}
|
||||||
|
$report->shop_id = $shop->id;
|
||||||
|
$report->cdate = $cdate;
|
||||||
|
$report->register_num = $registerNum;
|
||||||
|
$report->buyer_num = $buyerNum;
|
||||||
|
$report->shop_banlance = $shopBalance;
|
||||||
|
$report->customers_balance = $customersBalance;
|
||||||
|
$report->chupiao_fee_money = $chupiao_fee_money;
|
||||||
|
$report->chupiao_money = $chupiaoMoney;
|
||||||
|
$report->send_prize = $sendMoney;
|
||||||
|
$report->win_prize = $winMoney;
|
||||||
|
$report->customer_withdraw = $withDraw;
|
||||||
|
$report->incr_money = $incrMoney;
|
||||||
|
$report->reduce_money = $reduceMoney;
|
||||||
|
$report->customer_recharge = $customerRecharge;
|
||||||
|
$report->cooperate_brokerage = $cooperateBrokerage;
|
||||||
|
$report->save();
|
||||||
|
return $report;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Report;
|
||||||
|
|
||||||
|
use App\Model\Order;
|
||||||
|
use App\Model\Report\ReportDayWin;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
class GenerateDayWin extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'report:generate_day_win {cdate?}';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$cdate = $this->argument('cdate');
|
||||||
|
if (!$cdate) {
|
||||||
|
$cdate = date('Ymd');
|
||||||
|
}
|
||||||
|
$winOrders = Order::where('win_date', $cdate)->get();
|
||||||
|
foreach ($winOrders as $order) {
|
||||||
|
|
||||||
|
$report = ReportDayWin::where('cdate', $cdate)
|
||||||
|
->where('order_id', $order->id)
|
||||||
|
->first();
|
||||||
|
if (!$report) {
|
||||||
|
$report = new ReportDayWin();
|
||||||
|
}
|
||||||
|
$report->cdate = $cdate;
|
||||||
|
$report->customer_id = $order->customer_id;
|
||||||
|
$report->order_id = $order->id;
|
||||||
|
$report->shop_id = $order->shop_id;
|
||||||
|
$report->lottery_id = $order->lottery_id;
|
||||||
|
$report->order_money = $order->money;
|
||||||
|
$report->order_prize = $order->lottery_prize;
|
||||||
|
$report->order_tax_prize = $order->lottery_tax_prize;
|
||||||
|
$report->order_send_prize = $order->lottery_send_prize;
|
||||||
|
$report->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,107 @@
|
||||||
|
<?php
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use App\Model\Seller\Shop;
|
||||||
|
use App\Model\ShopAgent;
|
||||||
|
use App\Model\ShopAgentBill;
|
||||||
|
use App\Model\Order;
|
||||||
|
use App\Model\Seller\ShopBill;
|
||||||
|
use Log;
|
||||||
|
//执行代理每日的提点计算
|
||||||
|
class ShopAgentBillCommand extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'ShopAgentBillCommand {sdate?} {edate?}';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '执行代理每日的提点计算';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new command instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*执行代理每日的提点计算
|
||||||
|
**/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
|
||||||
|
$sdate = empty($this->argument('sdate')) ? date("Ymd",strtotime("-1 day")) : $this->argument('sdate');
|
||||||
|
$edate = empty($this->argument('edate')) ? date("Ymd",strtotime("-1 day")) : $this->argument('edate');
|
||||||
|
//查询服务费日志
|
||||||
|
$data = ShopBill::selectRaw('created_date,order_id,money as use_amount,shop_id')
|
||||||
|
->where('type',2)
|
||||||
|
->whereBetween('created_date',[$sdate,$edate])
|
||||||
|
->get()->map(function($item){
|
||||||
|
//查询对应的流水
|
||||||
|
$item->amount = Order::where('id',$item->order_id)->value('money');
|
||||||
|
$item->use_rate = 0.004; //平台服务费 费率
|
||||||
|
$item->shop_agent_id = Shop::where('id',$item->shop_id)->value('shop_agent_id');
|
||||||
|
$item->shop_agent_pid = $item->shop_agent_id>0?ShopAgent::where('agent_id',$item->shop_agent_id)->value('agent_pid'):0;
|
||||||
|
return $item;
|
||||||
|
})->toArray();
|
||||||
|
|
||||||
|
$newdata = [];
|
||||||
|
foreach ($data as $k => $v) {
|
||||||
|
$newdata[$v['created_date']][$v['shop_id']] = $v;
|
||||||
|
$newdata[$v['created_date']][$v['shop_id']]['amount'] = isset($newdata[$v['created_date']][$v['shop_id']]['amount'])?$newdata[$v['created_date']][$v['shop_id']]['amount']:0+$v['amount'];
|
||||||
|
$newdata[$v['created_date']][$v['shop_id']]['use_amount'] = isset($newdata[$v['created_date']][$v['shop_id']]['use_amount'])?$newdata[$v['created_date']][$v['shop_id']]['use_amount']:0+$v['use_amount'];
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($newdata as $k => $v) {
|
||||||
|
foreach ($v as $kk => $vv) {
|
||||||
|
// if($vv['shop_agent_id']==0) continue; //没有代理的不需要跑数据
|
||||||
|
$cdate = date("Y-m-d",strtotime($k));
|
||||||
|
if($vv['shop_agent_pid']==0){
|
||||||
|
//一级代理
|
||||||
|
$agent_rate = ShopAgentBill::SHOP_AGENT_RATE_ONE;
|
||||||
|
}else{
|
||||||
|
//二级代理
|
||||||
|
$agent_rate = ShopAgentBill::SHOP_AGENT_RATE_TWO;
|
||||||
|
//写入自己下面的二代店铺的提成
|
||||||
|
$checkdata = ['shop_id'=>$kk,'cdate'=>$cdate,'shop_agent_id'=>$vv['shop_agent_pid'],'shop_agent_pid'=>0];
|
||||||
|
$indata = ['amount'=>$vv['amount'],
|
||||||
|
'use_rate'=>$vv['use_rate'],
|
||||||
|
'use_amount'=>$vv['use_amount'],
|
||||||
|
'ctype'=>1,
|
||||||
|
'agent_rate'=>ShopAgentBill::SHOP_AGENT_RATE_SUPPER,
|
||||||
|
'agent_amount'=>$vv['use_amount']*ShopAgentBill::SHOP_AGENT_RATE_SUPPER
|
||||||
|
];
|
||||||
|
$ret = ShopAgentBill::updateOrCreate(
|
||||||
|
$checkdata,
|
||||||
|
$indata
|
||||||
|
);
|
||||||
|
}
|
||||||
|
//写入自己代理的店铺提成
|
||||||
|
$checkdata = ['shop_id'=>$kk,'cdate'=>$cdate,'shop_agent_id'=>$vv['shop_agent_id'],'shop_agent_pid'=>$vv['shop_agent_pid']];
|
||||||
|
$indata = ['amount'=>$vv['amount'],
|
||||||
|
'use_rate'=>$vv['use_rate'],
|
||||||
|
'use_amount'=>$vv['use_amount'],
|
||||||
|
'ctype'=>1,
|
||||||
|
'agent_rate'=>$agent_rate,
|
||||||
|
'agent_amount'=>$vv['use_amount']*$agent_rate
|
||||||
|
];
|
||||||
|
$ret = ShopAgentBill::updateOrCreate(
|
||||||
|
$checkdata,
|
||||||
|
$indata
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dd('over');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Enums\BoolEnum;
|
||||||
|
use App\Enums\LottState;
|
||||||
|
use App\Enums\LottType;
|
||||||
|
use App\Enums\OrderType;
|
||||||
|
use App\Events\OrderWinedEvent;
|
||||||
|
use App\Jobs\RefreshOrderCtzqBqcResult;
|
||||||
|
use App\Jobs\RefreshOrderCtzqJqcResult;
|
||||||
|
use App\Jobs\RefreshOrderJclqResult;
|
||||||
|
use App\Jobs\RefreshOrderJczqResult;
|
||||||
|
use App\Model\Config;
|
||||||
|
use App\Model\Customer\Customer;
|
||||||
|
use App\Model\Lq\JclqResult;
|
||||||
|
use App\Model\Order;
|
||||||
|
use App\Model\OrderBjdcResult;
|
||||||
|
use App\Model\OrderBjdcZuhe;
|
||||||
|
use App\Model\OrderJclqResult;
|
||||||
|
use App\Model\OrderLqZuhe;
|
||||||
|
use App\Model\Zq\BjdcResult;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class SumCustomerGendanNum extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'customer:sum_gendan_num';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$orders = Order::select([
|
||||||
|
'customer_id',
|
||||||
|
DB::raw('count(*) as c')
|
||||||
|
])
|
||||||
|
->where('type', OrderType::FADAN)
|
||||||
|
->whereIn('lottery_state', [LottState::WIN, LottState::SEND])
|
||||||
|
->groupBy('customer_id')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$customerIds = collect($orders)->pluck('customer_id')->toArray();
|
||||||
|
if (!$customerIds) {
|
||||||
|
dd('not found customer');
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$customers = Customer::whereIn('id', $customerIds)->get();
|
||||||
|
|
||||||
|
foreach ($customers as $customer) {
|
||||||
|
$orderIds = Order::where('type', OrderType::FADAN)
|
||||||
|
->whereIn('lottery_state', [LottState::WIN, LottState::SEND])
|
||||||
|
->where('customer_id', $customer->id)
|
||||||
|
->pluck('id')->toArray();
|
||||||
|
if (!$orderIds) {
|
||||||
|
dump('customer:'.$customer->id. ' not found fadan');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$gendanNum = Order::whereIn('pid', $orderIds)
|
||||||
|
->whereIn('lottery_state', [LottState::WIN, LottState::SEND, LottState::LOSS])
|
||||||
|
->count();
|
||||||
|
Customer::where('id', $customer->id)
|
||||||
|
->update([
|
||||||
|
'gendan_num' => $gendanNum
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Enums\BoolEnum;
|
||||||
|
use App\Enums\LottState;
|
||||||
|
use App\Enums\LottType;
|
||||||
|
use App\Enums\OrderType;
|
||||||
|
use App\Events\OrderWinedEvent;
|
||||||
|
use App\Jobs\HandleOrderWin;
|
||||||
|
use App\Jobs\RefreshOrderCtzqBqcResult;
|
||||||
|
use App\Jobs\RefreshOrderCtzqJqcResult;
|
||||||
|
use App\Jobs\RefreshOrderJclqResult;
|
||||||
|
use App\Jobs\RefreshOrderJczqResult;
|
||||||
|
use App\Model\Config;
|
||||||
|
use App\Model\Customer\Customer;
|
||||||
|
use App\Model\Lq\JclqResult;
|
||||||
|
use App\Model\Order;
|
||||||
|
use App\Model\OrderBjdcResult;
|
||||||
|
use App\Model\OrderBjdcZuhe;
|
||||||
|
use App\Model\OrderJclqResult;
|
||||||
|
use App\Model\OrderLqZuhe;
|
||||||
|
use App\Model\Zq\BjdcResult;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class SumCustomerPrize extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'customer:sum_prize';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
|
||||||
|
Order::whereIn('lottery_state', [LottState::WIN, LottState::SEND])
|
||||||
|
->chunkById(500, function($orders) {
|
||||||
|
foreach ($orders as $order) {
|
||||||
|
|
||||||
|
if ($order->type == OrderType::UNION) {
|
||||||
|
$this->handleUnionOrder($order);
|
||||||
|
} else {
|
||||||
|
$this->handleUnUnionOrder($order);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handleUnionOrder(Order $order) {
|
||||||
|
|
||||||
|
$perPrize = $order->lottery_prize / $order->union_piece_total;
|
||||||
|
// 合买参与人的数据
|
||||||
|
$unionOrders = Order::where('type', OrderType::UNION)
|
||||||
|
->where('pid', $order->id)
|
||||||
|
->get();
|
||||||
|
foreach ($unionOrders as $unionOrder) {
|
||||||
|
|
||||||
|
$buyPiece = $unionOrder->union_piece_self;
|
||||||
|
if ($unionOrder->id == $unionOrder->pid) {
|
||||||
|
$buyPiece = $unionOrder->union_piece_self + $unionOrder->union_piece_keep;
|
||||||
|
}
|
||||||
|
$winPrize = $perPrize * $buyPiece;
|
||||||
|
Customer::where('id', $unionOrder->customer_id)->update([
|
||||||
|
'win_prize_total' => DB::raw("`win_prize_total` + {$winPrize}")
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handleUnUnionOrder(Order $order) {
|
||||||
|
Customer::where('id', $order->customer_id)->update([
|
||||||
|
'win_prize_total' => DB::raw("`win_prize_total` + {$order->lottery_prize}")
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Table;
|
||||||
|
|
||||||
|
use App\Model\Config;
|
||||||
|
use App\Model\Customer\CustomerBill;
|
||||||
|
use App\Model\Customer\CustomerFreeze;
|
||||||
|
use App\Model\Customer\CustomerRecharge;
|
||||||
|
use App\Model\Customer\CustomerWithdraw;
|
||||||
|
use App\Model\Seller\ShopBill;
|
||||||
|
use App\Model\Seller\ShopCooperateBill;
|
||||||
|
use App\Model\Seller\ShopFreeze;
|
||||||
|
use App\Model\Seller\ShopRecharge;
|
||||||
|
use App\Model\ShopAgentBill;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
class OptimizeBills extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'optimize:bills';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '优化流水相关的表,物理删除数据';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$currentDate = Config::keepDataDate();
|
||||||
|
|
||||||
|
// 账单流水
|
||||||
|
CustomerBill::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
ShopAgentBill::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
ShopBill::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
ShopCooperateBill::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
// 充值记录
|
||||||
|
CustomerRecharge::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
ShopRecharge::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
// 提现
|
||||||
|
CustomerWithdraw::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
|
||||||
|
CustomerFreeze::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
ShopFreeze::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Table;
|
||||||
|
|
||||||
|
use App\Model\Config;
|
||||||
|
use App\Model\Feedback;
|
||||||
|
use App\Model\Seller\SellerFeedback;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
class OptimizeFeedback extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'optimize:feedback';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '优化反馈相关的表,物理删除数据';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$currentDate = Config::keepDataDate();
|
||||||
|
Feedback::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
|
||||||
|
SellerFeedback::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Table;
|
||||||
|
|
||||||
|
use App\Model\Config;
|
||||||
|
use App\Model\Order;
|
||||||
|
use App\Model\OrderBjdcResult;
|
||||||
|
use App\Model\OrderBjdcSfggResult;
|
||||||
|
use App\Model\OrderBjdcSfggZuhe;
|
||||||
|
use App\Model\OrderBjdcZuhe;
|
||||||
|
use App\Model\OrderCtzqBqcResult;
|
||||||
|
use App\Model\OrderCtzqJqcResult;
|
||||||
|
use App\Model\OrderCtzqSfcResult;
|
||||||
|
use App\Model\OrderGuanResult;
|
||||||
|
use App\Model\OrderGuanYaResult;
|
||||||
|
use App\Model\OrderJclqResult;
|
||||||
|
use App\Model\OrderJczqResult;
|
||||||
|
use App\Model\OrderLqZuhe;
|
||||||
|
use App\Model\OrderZuhe;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
class OptimizeOrder extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'optimize:order';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '优化订单相关的表,物理删除数据';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$currentDate = Config::keepDataDate();
|
||||||
|
// 删除订单
|
||||||
|
Order::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
OrderZuhe::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
OrderLqZuhe::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
OrderBjdcZuhe::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
OrderBjdcSfggZuhe::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
|
||||||
|
OrderJczqResult::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
OrderJclqResult::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
OrderBjdcSfggResult::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
OrderBjdcResult::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
OrderCtzqBqcResult::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
OrderCtzqJqcResult::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
OrderCtzqSfcResult::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
OrderGuanResult::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
OrderGuanYaResult::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Table;
|
||||||
|
|
||||||
|
use App\Model\Config;
|
||||||
|
use App\Model\Customer\CustomerRanking;
|
||||||
|
use App\Model\Report\ReportDaySeller;
|
||||||
|
use App\Model\Report\ReportDayShop;
|
||||||
|
use App\Model\Report\ReportDayWin;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
class OptimizeReport extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'optimize:report';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '优化统计相关的表,物理删除数据';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$currentDate = Config::keepDataDate();
|
||||||
|
|
||||||
|
CustomerRanking::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
ReportDaySeller::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
ReportDayShop::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
ReportDayWin::where('created_at', '<', $currentDate)
|
||||||
|
->forceDelete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,103 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Enums\LottState;
|
||||||
|
use App\Enums\LottType;
|
||||||
|
use App\Jobs\ComputeBjdcOrderPrize;
|
||||||
|
use App\Jobs\ComputeBjdcSfggOrderPrize;
|
||||||
|
use App\Jobs\ComputeCtzqBqcOrderPrize;
|
||||||
|
use App\Jobs\ComputeCtzqJqcOrderPrize;
|
||||||
|
use App\Jobs\ComputeCtzqSfc14OrderPrize;
|
||||||
|
use App\Jobs\ComputeCtzqSfc9OrderPrize;
|
||||||
|
use App\Jobs\ComputeDltOrderPrize;
|
||||||
|
use App\Jobs\ComputeJclqOrderPrize;
|
||||||
|
use App\Jobs\ComputeJczqOrderPrize;
|
||||||
|
use App\Jobs\ComputePlsOrderPrize;
|
||||||
|
use App\Jobs\ComputePlwOrderPrize;
|
||||||
|
use App\Jobs\ComputeQxcOrderPrize;
|
||||||
|
use App\Model\Order;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
class TestReComputePrize extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'test:recompute {ids}';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$ids = $this->argument('ids');
|
||||||
|
if (!$ids) {
|
||||||
|
dd('请输订单id');
|
||||||
|
}
|
||||||
|
|
||||||
|
$idList = explode(',', $ids);
|
||||||
|
foreach ($idList as $id) {
|
||||||
|
$order = Order::find($id);
|
||||||
|
|
||||||
|
if ($order->lottery_state != LottState::WIN) {
|
||||||
|
dump(sprintf('订单%d的状态不对:%d', $order->id, $order->lottery_state));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$order->lottery_state = LottState::WAIT;
|
||||||
|
$order->save();
|
||||||
|
|
||||||
|
switch ($order->lotteryType->type) {
|
||||||
|
case LottType::JCZQ:
|
||||||
|
ComputeJczqOrderPrize::dispatch($id);
|
||||||
|
return;
|
||||||
|
case LottType::JCLQ:
|
||||||
|
ComputeJclqOrderPrize::dispatch($id);
|
||||||
|
return;
|
||||||
|
case LottType::CTZQ_JQC:
|
||||||
|
ComputeCtzqJqcOrderPrize::dispatch($id);
|
||||||
|
return;
|
||||||
|
case LottType::CTZQ_BQC:
|
||||||
|
ComputeCtzqBqcOrderPrize::dispatch($id);
|
||||||
|
return;
|
||||||
|
case LottType::CTZQ_SFC9:
|
||||||
|
ComputeCtzqSfc9OrderPrize::dispatch($id);
|
||||||
|
return;
|
||||||
|
case LottType::CTZQ_SFC14:
|
||||||
|
ComputeCtzqSfc14OrderPrize::dispatch($id);
|
||||||
|
return;
|
||||||
|
case LottType::BJDC_SFGG:
|
||||||
|
ComputeBjdcSfggOrderPrize::dispatch($id);
|
||||||
|
return;
|
||||||
|
case LottType::BJDC:
|
||||||
|
ComputeBjdcOrderPrize::dispatch($id);
|
||||||
|
return;
|
||||||
|
case LottType::DLT:
|
||||||
|
ComputeDltOrderPrize::dispatch($id);
|
||||||
|
return;
|
||||||
|
case LottType::PLS:
|
||||||
|
ComputePlsOrderPrize::dispatch($id);
|
||||||
|
return;
|
||||||
|
case LottType::PLW:
|
||||||
|
ComputePlwOrderPrize::dispatch($id);
|
||||||
|
return;
|
||||||
|
case LottType::QXC:
|
||||||
|
ComputeQxcOrderPrize::dispatch($id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,252 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Enums\BoolEnum;
|
||||||
|
use App\Enums\LottState;
|
||||||
|
use App\Enums\LottType;
|
||||||
|
use App\Enums\OrderType;
|
||||||
|
use App\Events\OrderWinedEvent;
|
||||||
|
use App\Jobs\RefreshOrderCtzqBqcResult;
|
||||||
|
use App\Jobs\RefreshOrderCtzqJqcResult;
|
||||||
|
use App\Jobs\RefreshOrderJclqResult;
|
||||||
|
use App\Jobs\RefreshOrderJczqResult;
|
||||||
|
use App\Model\Config;
|
||||||
|
use App\Model\Lq\JclqResult;
|
||||||
|
use App\Model\Order;
|
||||||
|
use App\Model\OrderBjdcResult;
|
||||||
|
use App\Model\OrderBjdcZuhe;
|
||||||
|
use App\Model\OrderJclqResult;
|
||||||
|
use App\Model\OrderLqZuhe;
|
||||||
|
use App\Model\Zq\BjdcResult;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class TestWinResult extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'test:win {lotteryType} {ids}';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$lotteryType = $this->argument('lotteryType');
|
||||||
|
if (!LottType::hasValue($lotteryType)) {
|
||||||
|
dd('error lotteryType:',[$lotteryType]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$ids = $this->argument('ids');
|
||||||
|
if (!$ids) {
|
||||||
|
dd('请输win结果ids');
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($lotteryType) {
|
||||||
|
case LottType::JCZQ:
|
||||||
|
$this->winJczq($ids);
|
||||||
|
return;
|
||||||
|
case LottType::JCLQ:
|
||||||
|
$this->winJclq($ids);
|
||||||
|
return;
|
||||||
|
case LottType::CTZQ_JQC:
|
||||||
|
$this->winCtzqJqc($ids);
|
||||||
|
return;
|
||||||
|
case LottType::CTZQ_BQC:
|
||||||
|
$this->winBqcJqc($ids);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public function winBqcJqc($ids)
|
||||||
|
{
|
||||||
|
dump('CtzqBqc------:', $ids);
|
||||||
|
$idArr = explode(',', $ids);
|
||||||
|
foreach ($idArr as $id) {
|
||||||
|
RefreshOrderCtzqBqcResult::dispatch($id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function winCtzqJqc($ids)
|
||||||
|
{
|
||||||
|
dump('CtzqJqc------:', $ids);
|
||||||
|
$idArr = explode(',', $ids);
|
||||||
|
foreach ($idArr as $id) {
|
||||||
|
RefreshOrderCtzqJqcResult::dispatch($id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function winJclq($ids)
|
||||||
|
{
|
||||||
|
dump('JclqResult------:', $ids);
|
||||||
|
$idArr = explode(',', $ids);
|
||||||
|
foreach ($idArr as $id) {
|
||||||
|
RefreshOrderJclqResult::dispatch($id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function winJczq($ids)
|
||||||
|
{
|
||||||
|
dump('JczqResult------:', $ids);
|
||||||
|
$idArr = explode(',', $ids);
|
||||||
|
foreach ($idArr as $id) {
|
||||||
|
RefreshOrderJczqResult::dispatch($id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function testwin()
|
||||||
|
{
|
||||||
|
$this->orderId = 126;
|
||||||
|
Log::info('ComputeBjdcOrderPrize::start, orderId:' . $this->orderId);
|
||||||
|
|
||||||
|
$unPublishes = OrderBjdcResult::where('order_id')->where('published', BoolEnum::NO)->count();
|
||||||
|
if ($unPublishes > 0) {
|
||||||
|
Log::error('ComputeBjdcOrderPrize has no publish match, orderId:' . $this->orderId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$order = Order::find($this->orderId);
|
||||||
|
if ($order->lottery_state != LottState::WAIT) {
|
||||||
|
Log::error('ComputeBjdcOrderPrize 订单状态不是待开奖状态, orderId:' . $this->orderId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$odds = $order->odds;
|
||||||
|
$jczqOddsIds = array_keys($odds);
|
||||||
|
$result = BjdcResult::whereIn('bjdc_odds_id', $jczqOddsIds)->get();
|
||||||
|
if (count($result) != count($jczqOddsIds)) {
|
||||||
|
Log::error('ComputeBjdcOrderPrize 开奖结果和投注信息中的id对应不上', [
|
||||||
|
'order_id' => $this->orderId,
|
||||||
|
'order_odds' => $odds,
|
||||||
|
'order_odds_ids' => $jczqOddsIds,
|
||||||
|
'result_odds_ids' => $result->pluck('bjdc_odds_id')->toArray(),
|
||||||
|
]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$results = BjdcResult::whereIn('bjdc_odds_id', $jczqOddsIds)->get()->keyBy('bjdc_odds_id');
|
||||||
|
|
||||||
|
$orderZuhe = OrderBjdcZuhe::where('order_id', $this->orderId)->get();
|
||||||
|
foreach ($orderZuhe as $zuhe) {
|
||||||
|
$this->computeZuhePrize($zuhe, $order, $results);
|
||||||
|
}
|
||||||
|
|
||||||
|
$winedZuhe = OrderBjdcZuhe::where('order_id', $this->orderId)
|
||||||
|
->where('wined', BoolEnum::YES)
|
||||||
|
->get();
|
||||||
|
if (count($winedZuhe) == 0) {
|
||||||
|
$order->lottery_state = LottState::LOSS;
|
||||||
|
$order->lottery_prize = 0;
|
||||||
|
$order->lottery_tax_prize = 0;
|
||||||
|
$order->save();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$winPrize = $winedZuhe->sum('win_prize');
|
||||||
|
$winTaxPrize = $winedZuhe->sum('win_tax_prize');
|
||||||
|
|
||||||
|
$shouldSendPrize = $winTaxPrize;
|
||||||
|
$gendanBrokerage = 0;
|
||||||
|
if ($order->type == OrderType::GENDAN) {
|
||||||
|
$gendanBrokerage = $winTaxPrize* Config::fadanAllFeeLv();
|
||||||
|
$shouldSendPrize = $winTaxPrize - $gendanBrokerage;
|
||||||
|
}
|
||||||
|
|
||||||
|
$order->lottery_state = LottState::WIN;
|
||||||
|
$order->lottery_prize = $winPrize;
|
||||||
|
$order->lottery_tax_prize = $winTaxPrize;
|
||||||
|
$order->lottery_should_send_prize = $shouldSendPrize;
|
||||||
|
$order->lottery_gendan_brokerage = $gendanBrokerage;
|
||||||
|
$order->win_date = date('Ymd');
|
||||||
|
$order->save();
|
||||||
|
|
||||||
|
OrderWinedEvent::dispatch($order->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function computeZuhePrize(OrderBjdcZuhe $orderZuhe, $order, $results)
|
||||||
|
{
|
||||||
|
$odds = $order->odds;
|
||||||
|
$buyOddsId = array_keys($odds);
|
||||||
|
$allWin = true;
|
||||||
|
$winPrize = 0;
|
||||||
|
$taxPrize = 0;
|
||||||
|
foreach ($orderZuhe->bjdc_odds_ids as $bjdc_odds_id) {
|
||||||
|
if (!in_array($bjdc_odds_id, $buyOddsId)) {
|
||||||
|
$allWin = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// dump($orderZuhe->id.'-----------------------'.$bjdc_odds_id);
|
||||||
|
|
||||||
|
$buyPlayKey = Arr::get($orderZuhe->info, $bjdc_odds_id . '.play');
|
||||||
|
$buyResultKey = Arr::get($orderZuhe->info, $bjdc_odds_id . '.result');
|
||||||
|
if ($buyPlayKey === null || $buyResultKey === null) {
|
||||||
|
$allWin = false;
|
||||||
|
Log::error('ComputeBjdcOrderPrize::checkZuhePrize error, 组合中没有该比赛信息', [
|
||||||
|
'zuhe_id' => $orderZuhe->id,
|
||||||
|
'order_id' => $order->id,
|
||||||
|
'zuhe_odds_ids' => $orderZuhe->bjdc_odds_ids,
|
||||||
|
'zuhe_info' => $orderZuhe->info,
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3.rq_odds.win = 3.85
|
||||||
|
$buyOdds = Arr::get($odds, $bjdc_odds_id . '.' . $buyPlayKey . '.' . $buyResultKey);
|
||||||
|
|
||||||
|
if ($buyOdds === null) {
|
||||||
|
$allWin = false;
|
||||||
|
Log::error('ComputeBjdcOrderPrize::checkZuhePrize error, 购买的投注信息中和组合中的数据不一致', [
|
||||||
|
'zuhe_id' => $orderZuhe->id,
|
||||||
|
'order_id' => $order->id,
|
||||||
|
'zuhe_odds_ids' => $orderZuhe->bjdc_odds_ids,
|
||||||
|
'zuhe_info' => $orderZuhe->info,
|
||||||
|
'order_odds' => $odds,
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$result = Arr::get($results, $bjdc_odds_id);
|
||||||
|
$buyField = str_replace('_odds', '', $buyPlayKey);
|
||||||
|
dump([
|
||||||
|
'$result' => $result->toArray(),
|
||||||
|
'$buyField' => $buyField,
|
||||||
|
'$buyResultKey' => $buyResultKey,
|
||||||
|
'comp' => $result->{$buyField.'_field'} == $buyResultKey
|
||||||
|
]);
|
||||||
|
if ($result->{$buyField.'_field'} == $buyResultKey) {
|
||||||
|
|
||||||
|
// 单注奖金
|
||||||
|
$perBetsPrize = $orderZuhe->bets_num * $buyOdds * Config::lotteryUnitPrice() * Config::bjdcPrizePercent();
|
||||||
|
|
||||||
|
$taxPrize += Config::getAfterTaxPrize($perBetsPrize);
|
||||||
|
$winPrize += $perBetsPrize;
|
||||||
|
} else {
|
||||||
|
$allWin = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dd($winPrize, $allWin);
|
||||||
|
|
||||||
|
// 该组合没有中奖
|
||||||
|
if (!$allWin) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$orderZuhe->win_prize = $winPrize;
|
||||||
|
$orderZuhe->win_tax_prize = $taxPrize;
|
||||||
|
$orderZuhe->wined = BoolEnum::YES;
|
||||||
|
$orderZuhe->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Zq;
|
||||||
|
|
||||||
|
use App\Enums\BoolEnum;
|
||||||
|
use App\Enums\LottState;
|
||||||
|
use App\Jobs\ComputeJczqOrderPrize;
|
||||||
|
use App\Model\Order;
|
||||||
|
use App\Model\OrderJczqResult;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class JczqResultRepair extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'zq:jczq_result_repair';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '竞彩足球开奖结果有时候会莫名奇妙的不更新数据,此脚本做补充';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$orderIds = OrderJczqResult::where('updated_at', '>', date('Y-m-d H:i:s', strtotime('-2 hour')))
|
||||||
|
->where('updated_at', '<=', date('Y-m-d H:i:s', time() - 30*60))
|
||||||
|
->where('published', BoolEnum::YES)
|
||||||
|
->pluck('order_id')
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
if (!$orderIds) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$orderIds = array_unique($orderIds);
|
||||||
|
if (!$orderIds) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$orderIds = Order::whereIn('id', $orderIds)->where('lottery_state', LottState::WAIT)->pluck('id')->toArray();
|
||||||
|
if (!$orderIds) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach ($orderIds as $orderId) {
|
||||||
|
$unPublishes = OrderJczqResult::where('order_id', $orderId)
|
||||||
|
->where('published', BoolEnum::NO)->count();
|
||||||
|
// 如果全部已公布,则计算奖金
|
||||||
|
if ($unPublishes == 0) {
|
||||||
|
Log::error('repair-- dispatch ComputeJczqOrderPrize, orderId:'.$orderId);
|
||||||
|
ComputeJczqOrderPrize::dispatch($orderId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,114 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Zq;
|
||||||
|
|
||||||
|
use App\Enums\LottType;
|
||||||
|
use App\Model\LotteryType;
|
||||||
|
use App\Model\Zq\BjdcOdds;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
class SyncBjdcOdds extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'zq:sync_bjdc_odds';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$this->syncOdds();
|
||||||
|
|
||||||
|
$sellingCount = BjdcOdds::selling()->where('close_time', '>', date('Y-m-d H:i:s'))->count();
|
||||||
|
$lotteryType = LotteryType::withTrashed()->where('type', LottType::BJDC)->first();
|
||||||
|
if (!$lotteryType) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$lotteryType->info = sprintf('%d场赛事可投', $sellingCount);
|
||||||
|
$lotteryType->save();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function syncOdds() {
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$odds = $alStatService->getZqBjdcOdds();
|
||||||
|
if (!$odds) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($odds as $item) {
|
||||||
|
$id = $item['id'];
|
||||||
|
$odd = BjdcOdds::where('odds_id',$id)->first();
|
||||||
|
if (!$odd) {
|
||||||
|
$odd = new BjdcOdds();
|
||||||
|
}
|
||||||
|
$odd->odds_id = $id;
|
||||||
|
$odd->match_id = strval(Arr::get($item, 'matchId'));
|
||||||
|
$odd->issue_num = strval(Arr::get($item, 'issueNum'));
|
||||||
|
$odd->play_num = strval(Arr::get($item, 'playNum'));
|
||||||
|
$odd->bd_competition_name = strval(Arr::get($item, 'bdComptName'));
|
||||||
|
$odd->bd_competition_name_full = strval(Arr::get($item, 'bdComptNameFull'));
|
||||||
|
$odd->bd_home_team_name = strval(Arr::get($item, 'bdHomeTeamName'));
|
||||||
|
$odd->bd_home_team_name_full = strval(Arr::get($item, 'bdHomeTeamNameFull'));
|
||||||
|
$odd->bd_away_team_name = strval(Arr::get($item, 'bdAwayTeamName'));
|
||||||
|
$odd->bd_away_team_name_full = strval(Arr::get($item, 'bdAwayTeamNameFull'));
|
||||||
|
$odd->sale_state = strval(Arr::get($item, 'salesState'));
|
||||||
|
$odd->is_reverse = strval(Arr::get($item, 'isReverse'));
|
||||||
|
$odd->close_time = strval(Arr::get($item, 'closeTime'));
|
||||||
|
$odd->spf_odds = Arr::get($item, 'spfOdds');
|
||||||
|
$odd->spf_odds_last = $this->oddsLast($odd->spf_odds_last, $odd->spf_odds);
|
||||||
|
|
||||||
|
$odd->rq_odds = Arr::get($item, 'rqOdds');
|
||||||
|
$odd->rq_odds_last = $this->oddsLast($odd->rq_odds_last, $odd->rq_odds);
|
||||||
|
|
||||||
|
$odd->sxpds_odds = Arr::get($item, 'sxpdsOdds');
|
||||||
|
$odd->sxpds_odds_last = $this->oddsLast($odd->sxpds_odds_last, $odd->sxpds_odds);
|
||||||
|
|
||||||
|
$odd->bf_odds =Arr::get($item, 'bfOdds');
|
||||||
|
$odd->bf_odds_last = $this->oddsLast($odd->bf_odds_last, $odd->bf_odds);
|
||||||
|
|
||||||
|
$odd->jq_odds = Arr::get($item, 'jqOdds');
|
||||||
|
$odd->jq_odds_last = $this->oddsLast($odd->jq_odds_last, $odd->jq_odds);
|
||||||
|
|
||||||
|
$odd->bqc_odds = Arr::get($item, 'bqcOdds');
|
||||||
|
$odd->bqc_odds_last = $this->oddsLast($odd->bqc_odds_last, $odd->bqc_odds);
|
||||||
|
|
||||||
|
$odd->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function oddsLast($fieldOldData, $fieldNewData) {
|
||||||
|
if (!$fieldOldData) {
|
||||||
|
return $fieldNewData;
|
||||||
|
}
|
||||||
|
foreach ($fieldNewData as $k => $v) {
|
||||||
|
if (Arr::get($fieldOldData, $k) != $v) {
|
||||||
|
return $fieldNewData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $fieldOldData;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,102 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Zq;
|
||||||
|
|
||||||
|
use App\Enums\LottType;
|
||||||
|
use App\Jobs\RefreshOrderBjdcResult;
|
||||||
|
use App\Model\LotteryType;
|
||||||
|
use App\Model\Zq\BjdcOdds;
|
||||||
|
use App\Model\Zq\BjdcResult;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
class SyncBjdcResult extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'zq:sync_bjdc_result';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$odds = $alStatService->getZqBjdcResult();
|
||||||
|
if (!$odds) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($odds as $item) {
|
||||||
|
$id = $item['bjdcOddId'];
|
||||||
|
$result = BjdcResult::where('odds_id',$id)->first();
|
||||||
|
if ($result) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$bjdcOdds = BjdcOdds::where('odds_id', $id)->first();
|
||||||
|
|
||||||
|
|
||||||
|
$result = new BjdcResult();
|
||||||
|
$result->bjdc_odds_id = $bjdcOdds ? $bjdcOdds->id : 0;
|
||||||
|
$result->odds_id = strval(Arr::get($item, 'bjdcOddId'));
|
||||||
|
$result->match_id = strval(Arr::get($item, 'matchId'));
|
||||||
|
$result->issue_num = strval(Arr::get($item, 'issueNum'));
|
||||||
|
$result->play_num = strval(Arr::get($item, 'playNum'));
|
||||||
|
$result->half_time_score = strval(Arr::get($item, 'halfTimeScore'));
|
||||||
|
$result->full_time_score = strval(Arr::get($item, 'fullTimeScore'));
|
||||||
|
$result->is_reverse = strval(Arr::get($item, 'isReverse'));
|
||||||
|
$result->lottery_state = strval(Arr::get($item, 'lottState'));
|
||||||
|
$result->lottery_time = strval(Arr::get($item, 'lotteryTime'));
|
||||||
|
|
||||||
|
$result->spf_odds = floatval(Arr::get($item, 'spfResult.resultOdds'));
|
||||||
|
$result->spf_name = strval(Arr::get($item, 'spfResult.resultName'));
|
||||||
|
$result->spf_field = strval(Arr::get($item, 'spfResult.resultField'));
|
||||||
|
|
||||||
|
$result->rq_odds = floatval(Arr::get($item, 'rqResult.resultOdds'));
|
||||||
|
$result->rq_name = strval(Arr::get($item, 'rqResult.resultName'));
|
||||||
|
$result->rq_field = strval(Arr::get($item, 'rqResult.resultField'));
|
||||||
|
$result->rq_handicap = intval(Arr::get($item, 'rqResult.resultHandicap'));
|
||||||
|
|
||||||
|
$result->sxpds_odds = floatval(Arr::get($item, 'sxpdsResult.resultOdds'));
|
||||||
|
$result->sxpds_field = strval(Arr::get($item, 'sxpdsResult.resultField'));
|
||||||
|
$result->sxpds_name = strval(Arr::get($item, 'sxpdsResult.resultName'));
|
||||||
|
|
||||||
|
$result->bf_odds = floatval(Arr::get($item, 'bfResult.resultOdds'));
|
||||||
|
$result->bf_field = strval(Arr::get($item, 'bfResult.resultField'));
|
||||||
|
$result->bf_name = strval(Arr::get($item, 'bfResult.resultName'));
|
||||||
|
|
||||||
|
$result->jq_odds = floatval(Arr::get($item, 'jqResult.resultOdds'));
|
||||||
|
$result->jq_field = strval(Arr::get($item, 'jqResult.resultField'));
|
||||||
|
$result->jq_name = strval(Arr::get($item, 'jqResult.resultName'));
|
||||||
|
|
||||||
|
$result->bqc_odds = floatval(Arr::get($item, 'bqcResult.resultOdds'));
|
||||||
|
$result->bqc_field = strval(Arr::get($item, 'bqcResult.resultField'));
|
||||||
|
$result->bqc_name = strval(Arr::get($item, 'bqcResult.resultName'));
|
||||||
|
|
||||||
|
$result->save();
|
||||||
|
|
||||||
|
RefreshOrderBjdcResult::dispatch($result->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Zq;
|
||||||
|
|
||||||
|
use App\Enums\LottType;
|
||||||
|
use App\Model\LotteryType;
|
||||||
|
use App\Model\Zq\BjdcOdds;
|
||||||
|
use App\Model\Zq\BjdcSfggOdds;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
class SyncBjdcSfggOdds extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'zq:sync_bjdc_sfgg_odds';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$this->syncOdds();
|
||||||
|
|
||||||
|
$sellingCount = BjdcSfggOdds::selling()->where('close_time', '>', date('Y-m-d H:i:s'))->count();
|
||||||
|
$lotteryType = LotteryType::withTrashed()->where('type', LottType::BJDC_SFGG)->first();
|
||||||
|
if (!$lotteryType) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$lotteryType->info = sprintf('%d场赛事可投', $sellingCount);
|
||||||
|
$lotteryType->save();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function syncOdds() {
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$odds = $alStatService->getZqBjdcSfggOdds();
|
||||||
|
if (!$odds) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($odds as $item) {
|
||||||
|
$id = $item['id'];
|
||||||
|
$odd = BjdcSfggOdds::where('odds_id',$id)->first();
|
||||||
|
if (!$odd) {
|
||||||
|
$odd = new BjdcSfggOdds();
|
||||||
|
}
|
||||||
|
$odd->odds_id = $id;
|
||||||
|
$odd->match_id = strval(Arr::get($item, 'matchId'));
|
||||||
|
$odd->issue_num = strval(Arr::get($item, 'issueNum'));
|
||||||
|
$odd->play_num = strval(Arr::get($item, 'playNum'));
|
||||||
|
$odd->bd_competition_name = strval(Arr::get($item, 'bdComptName'));
|
||||||
|
$odd->bd_competition_name_full = strval(Arr::get($item, 'bdComptNameFull'));
|
||||||
|
$odd->bd_home_team_name = strval(Arr::get($item, 'bdHomeTeamName'));
|
||||||
|
$odd->bd_home_team_name_full = strval(Arr::get($item, 'bdHomeTeamNameFull'));
|
||||||
|
$odd->bd_away_team_name = strval(Arr::get($item, 'bdAwayTeamName'));
|
||||||
|
$odd->bd_away_team_name_full = strval(Arr::get($item, 'bdAwayTeamNameFull'));
|
||||||
|
$odd->sale_state = strval(Arr::get($item, 'salesState'));
|
||||||
|
$odd->is_reverse = strval(Arr::get($item, 'isReverse'));
|
||||||
|
$odd->close_time = strval(Arr::get($item, 'closeTime'));
|
||||||
|
$odd->sfgg_odds = Arr::get($item, 'sfggOdds', []);
|
||||||
|
$odd->sfgg_odds_last = $this->oddsLast($odd->sfgg_odds_last, $odd->sfgg_odds);
|
||||||
|
|
||||||
|
$odd->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function oddsLast($fieldOldData, $fieldNewData) {
|
||||||
|
if (!$fieldOldData) {
|
||||||
|
return $fieldNewData;
|
||||||
|
}
|
||||||
|
foreach ($fieldNewData as $k => $v) {
|
||||||
|
if (Arr::get($fieldOldData, $k) != $v) {
|
||||||
|
return $fieldNewData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $fieldOldData;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,82 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Zq;
|
||||||
|
|
||||||
|
use App\Enums\LottType;
|
||||||
|
use App\Jobs\RefreshOrderBjdcSfggResult;
|
||||||
|
use App\Model\LotteryType;
|
||||||
|
use App\Model\Zq\BjdcOdds;
|
||||||
|
use App\Model\Zq\BjdcSfggOdds;
|
||||||
|
use App\Model\Zq\BjdcSfggResult;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
class SyncBjdcSfggResult extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'zq:sync_bjdc_sfgg_result';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$odds = $alStatService->getZqBjdcSfggResult();
|
||||||
|
if (!$odds) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($odds as $item) {
|
||||||
|
$id = $item['bjdcSfggOddId'];
|
||||||
|
$result = BjdcSfggResult::where('odds_id',$id)->first();
|
||||||
|
if ($result) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$bjdcOdds = BjdcSfggOdds::where('odds_id', $id)->first();
|
||||||
|
|
||||||
|
$result = new BjdcSfggResult();
|
||||||
|
$result->bjdc_sfgg_odds_id = $bjdcOdds ? $bjdcOdds->id : 0;
|
||||||
|
$result->odds_id = strval(Arr::get($item, 'bjdcSfggOddId'));
|
||||||
|
$result->match_id = strval(Arr::get($item, 'matchId'));
|
||||||
|
$result->issue_num = strval(Arr::get($item, 'issueNum'));
|
||||||
|
$result->play_num = strval(Arr::get($item, 'playNum'));
|
||||||
|
$result->half_time_score = strval(Arr::get($item, 'halfTimeScore'));
|
||||||
|
$result->full_time_score = strval(Arr::get($item, 'fullTimeScore'));
|
||||||
|
$result->is_reverse = strval(Arr::get($item, 'isReverse'));
|
||||||
|
$result->lottery_state = strval(Arr::get($item, 'lottState'));
|
||||||
|
$result->lottery_time = strval(Arr::get($item, 'lotteryTime'));
|
||||||
|
|
||||||
|
$result->sfgg_odds = floatval(Arr::get($item, 'sfggResult.resultOdds'));
|
||||||
|
$result->sfgg_handicap = floatval(Arr::get($item, 'sfggResult.handicap'));
|
||||||
|
$result->sfgg_name = strval(Arr::get($item, 'sfggResult.resultName'));
|
||||||
|
$result->sfgg_field = strval(Arr::get($item, 'sfggResult.resultField'));
|
||||||
|
|
||||||
|
$result->save();
|
||||||
|
|
||||||
|
RefreshOrderBjdcSfggResult::dispatch($result->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Zq;
|
||||||
|
|
||||||
|
use App\Model\Zq\ZqCompetition;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
class SyncCompetition extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'zq:sync_competition';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$competitions = $alStatService->getZqCompetition();
|
||||||
|
if (!$competitions) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($competitions as $item) {
|
||||||
|
|
||||||
|
$competition = ZqCompetition::where('competition_id', $item['id'])->first();
|
||||||
|
if (!$competition) {
|
||||||
|
$competition = new ZqCompetition();
|
||||||
|
}
|
||||||
|
$competition->competition_id = $item['id'];
|
||||||
|
$competition->name = strval(Arr::get($item, 'name'));
|
||||||
|
$competition->name_full = strval(Arr::get($item, 'nameFull'));
|
||||||
|
$competition->name_en = strval(Arr::get($item, 'nameEn'));
|
||||||
|
$competition->name_en_full = strval(Arr::get($item, 'nameEnFull'));
|
||||||
|
$competition->competition_type = strval(Arr::get($item, 'competitionType'));
|
||||||
|
$competition->team_type = strval(Arr::get($item, 'teamType'));
|
||||||
|
$competition->country = strval( Arr::get($item, 'country'));
|
||||||
|
$competition->curr_season = strval(Arr::get($item, 'currSeason'));
|
||||||
|
$competition->seasons = Arr::get($item, 'seasons', []);
|
||||||
|
$competition->colour = strval(Arr::get($item, 'colour'));
|
||||||
|
$competition->has_detail = strval(Arr::get($item, 'hasDetail'));
|
||||||
|
$competition->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,104 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Zq;
|
||||||
|
|
||||||
|
use App\Model\Zq\ZqCompetition;
|
||||||
|
use App\Model\Zq\ZqCompetitionScore;
|
||||||
|
use App\Model\Zq\ZqCompetitionScoreHome;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
class SyncCompetitionScore extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'zq:sync_competition_score';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
|
||||||
|
ZqCompetition::select(['id','competition_id', 'curr_season'])
|
||||||
|
->chunkById(500, function($competitions) {
|
||||||
|
foreach ($competitions as $competition) {
|
||||||
|
$this->syncScore($competition->competition_id, $competition->curr_season);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function syncScore($competitionId, $season) {
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$competitions = $alStatService->getZqLeaqueTableDetail($competitionId, $season);
|
||||||
|
if (!$competitions) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$allScores = Arr::get($competitions, 'overall');
|
||||||
|
if (!empty($allScores)) {
|
||||||
|
// $this->syncAll($allScores, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$homeScores = Arr::get($competitions, 'home');
|
||||||
|
if (!empty($homeScores)) {
|
||||||
|
$this->syncAll($homeScores, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
$awayScores = Arr::get($competitions, 'away');
|
||||||
|
if (!empty($awayScores)) {
|
||||||
|
$this->syncAll($awayScores, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function syncAll($scores, $type) {
|
||||||
|
foreach ($scores as $item) {
|
||||||
|
|
||||||
|
$competitionScore = ZqCompetitionScore::where('competition_score_id', $item['id'])->first();
|
||||||
|
if (!$competitionScore) {
|
||||||
|
$competitionScore = new ZqCompetitionScore();
|
||||||
|
$competitionScore->competition_score_id = $item['id'];
|
||||||
|
$competitionScore->type = $type;
|
||||||
|
}
|
||||||
|
|
||||||
|
$competitionScore->competition_id = intval(Arr::get($item, 'competitionId'));
|
||||||
|
$competitionScore->season = strval(Arr::get($item, 'season'));
|
||||||
|
$competitionScore->team_id = intval(Arr::get($item, 'teamId'));
|
||||||
|
$competitionScore->team_name = strval(Arr::get($item, 'teamName'));
|
||||||
|
$competitionScore->group_id = intval(Arr::get($item, 'groupId'));
|
||||||
|
$competitionScore->matches = intval(Arr::get($item, 'matches'));
|
||||||
|
$competitionScore->wins = intval(Arr::get($item, 'wins'));
|
||||||
|
$competitionScore->draws = intval(Arr::get($item, 'draws'));
|
||||||
|
$competitionScore->losts = intval(Arr::get($item, 'losts'));
|
||||||
|
$competitionScore->goal_for = intval(Arr::get($item, 'goalFor'));
|
||||||
|
$competitionScore->goal_aga = intval(Arr::get($item, 'goalAga'));
|
||||||
|
$competitionScore->goal_diff = intval(Arr::get($item, 'goalDiff'));
|
||||||
|
$competitionScore->points = intval(Arr::get($item, 'points'));
|
||||||
|
$competitionScore->position = intval(Arr::get($item, 'position'));
|
||||||
|
$competitionScore->qualificate = strval(Arr::get($item, 'qualificate'));
|
||||||
|
$competitionScore->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,255 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Zq;
|
||||||
|
|
||||||
|
use App\Enums\LottType;
|
||||||
|
use App\Jobs\RefreshOrderCtzqBqcResult;
|
||||||
|
use App\Jobs\RefreshOrderCtzqJqcResult;
|
||||||
|
use App\Jobs\RefreshOrderCtzqSfc14Result;
|
||||||
|
use App\Jobs\RefreshOrderCtzqSfc9Result;
|
||||||
|
use App\Model\Zq\CtzqBqc;
|
||||||
|
use App\Model\Zq\CtzqBqcMatch;
|
||||||
|
use App\Model\Zq\CtzqJqc;
|
||||||
|
use App\Model\Zq\CtzqJqcMatch;
|
||||||
|
use App\Model\Zq\CtzqSfc;
|
||||||
|
use App\Model\Zq\CtzqSfcMatch;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class SyncCtzq extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'zq:sync_ctzq';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
Log::info('SyncCtzq 同步传统足球数据');
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$data = $alStatService->getZqCtzq();
|
||||||
|
|
||||||
|
$jqcData = Arr::get($data, LottType::CTZQ_JQC);
|
||||||
|
$this->saveJqc($jqcData);
|
||||||
|
|
||||||
|
$bqcData = Arr::get($data, LottType::CTZQ_BQC);
|
||||||
|
$this->saveBqc($bqcData);
|
||||||
|
|
||||||
|
$sfcData = Arr::get($data, 'sfc');
|
||||||
|
$this->saveSfc($sfcData);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function saveJqc($data)
|
||||||
|
{
|
||||||
|
if (!$data) {
|
||||||
|
Log::error('SyncCtzq::saveJqc data is null');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach ($data as $item) {
|
||||||
|
$ctzq = CtzqJqc::where('jqc_id', $item['id'])
|
||||||
|
->first();
|
||||||
|
if (!$ctzq) {
|
||||||
|
$ctzq = new CtzqJqc();
|
||||||
|
}
|
||||||
|
$ctzq->jqc_id = $item['id'];
|
||||||
|
$ctzq->issue_num = strval(Arr::get($item, 'issueNum'));
|
||||||
|
$ctzq->state = strval(Arr::get($item, 'state'));
|
||||||
|
$ctzq->start_time =strval(Arr::get($item, 'startTime'));
|
||||||
|
$ctzq->end_time = strval(Arr::get($item, 'endTime'));
|
||||||
|
$ctzq->prize_time = strval(Arr::get($item, 'prizeTime'));
|
||||||
|
$ctzq->result_info = strval(Arr::get($item, 'resultInfo'));
|
||||||
|
$ctzq->sales = floatval(Arr::get($item, 'sales'));
|
||||||
|
$ctzq->jackpot = floatval(Arr::get($item, 'jackpot'));
|
||||||
|
$ctzq->first_prize_num = intval(Arr::get($item, 'firstPrizeNum'));
|
||||||
|
$ctzq->first_prize_value =floatval(Arr::get($item, 'firstPrizeValue'));
|
||||||
|
$ctzq->matchs = Arr::get($item, 'matchs', []);
|
||||||
|
$ctzq->save();
|
||||||
|
|
||||||
|
$this->saveCtzqJqcMatches($ctzq, Arr::get($item, 'matchs'));
|
||||||
|
|
||||||
|
// 如果win
|
||||||
|
if ($ctzq->result_info) {
|
||||||
|
RefreshOrderCtzqJqcResult::dispatch($ctzq->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private function saveCtzqJqcMatches(CtzqJqc $ctzq, $matches)
|
||||||
|
{
|
||||||
|
if (!$matches) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($matches as $item) {
|
||||||
|
$match = CtzqJqcMatch::where('ctzq_jqc_id', $ctzq->id)->where('match_id', $item['matchId'])->first();
|
||||||
|
if (!$match) {
|
||||||
|
$match = new CtzqJqcMatch();
|
||||||
|
}
|
||||||
|
$match->ctzq_jqc_id = $ctzq->id;
|
||||||
|
$match->match_id = $item['matchId'];
|
||||||
|
$match->jc_home_team_name = strval(Arr::get($item, 'jcHomeTeamName'));
|
||||||
|
$match->jc_home_team_name_full = strval(Arr::get($item, 'jcHomeTeamNameFull'));
|
||||||
|
$match->jc_away_team_name = strval(Arr::get($item, 'jcAwayTeamName'));
|
||||||
|
$match->jc_away_team_name_full = strval(Arr::get($item, 'jcAwayTeamNameFull'));
|
||||||
|
$match->is_reverse = intval(Arr::get($item, 'isReverse'));
|
||||||
|
$no = $item['no'];
|
||||||
|
if ($no % 2 == 0) {
|
||||||
|
$match->away_result = $item['result'];
|
||||||
|
} else {
|
||||||
|
$match->home_result = $item['result'];
|
||||||
|
}
|
||||||
|
$match->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function saveBqc($data)
|
||||||
|
{
|
||||||
|
if (!$data) {
|
||||||
|
Log::error('SyncCtzq::saveBqc data is null');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach ($data as $item) {
|
||||||
|
$ctzq = CtzqBqc::where('bqc_id', $item['id'])
|
||||||
|
->first();
|
||||||
|
if (!$ctzq) {
|
||||||
|
$ctzq = new CtzqBqc();
|
||||||
|
}
|
||||||
|
$ctzq->bqc_id = $item['id'];
|
||||||
|
$ctzq->issue_num = strval(Arr::get($item, 'issueNum'));
|
||||||
|
$ctzq->state = strval(Arr::get($item, 'state'));
|
||||||
|
$ctzq->start_time =strval(Arr::get($item, 'startTime'));
|
||||||
|
$ctzq->end_time = strval(Arr::get($item, 'endTime'));
|
||||||
|
$ctzq->prize_time = strval(Arr::get($item, 'prizeTime'));
|
||||||
|
$ctzq->result_info = strval(Arr::get($item, 'resultInfo'));
|
||||||
|
$ctzq->sales = floatval(Arr::get($item, 'sales'));
|
||||||
|
$ctzq->jackpot = floatval(Arr::get($item, 'jackpot'));
|
||||||
|
$ctzq->first_prize_num = intval(Arr::get($item, 'firstPrizeNum'));
|
||||||
|
$ctzq->first_prize_value =floatval(Arr::get($item, 'firstPrizeValue'));
|
||||||
|
$ctzq->matchs = Arr::get($item, 'matchs', []);
|
||||||
|
$ctzq->save();
|
||||||
|
$this->saveCtzqBqcMatches($ctzq,Arr::get($item, 'matchs', []));
|
||||||
|
// 如果win
|
||||||
|
if ($ctzq->result_info) {
|
||||||
|
RefreshOrderCtzqBqcResult::dispatch($ctzq->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private function saveCtzqBqcMatches(CtzqBqc $ctzq, $matches)
|
||||||
|
{
|
||||||
|
if (!$matches) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($matches as $item) {
|
||||||
|
$match = CtzqBqcMatch::where('ctzq_bqc_id', $ctzq->id)->where('match_id', $item['matchId'])->first();
|
||||||
|
if (!$match) {
|
||||||
|
$match = new CtzqBqcMatch();
|
||||||
|
}
|
||||||
|
$match->ctzq_bqc_id = $ctzq->id;
|
||||||
|
$match->match_id = $item['matchId'];
|
||||||
|
$match->jc_home_team_name = strval(Arr::get($item, 'jcHomeTeamName'));
|
||||||
|
$match->jc_home_team_name_full = strval(Arr::get($item, 'jcHomeTeamNameFull'));
|
||||||
|
$match->jc_away_team_name = strval(Arr::get($item, 'jcAwayTeamName'));
|
||||||
|
$match->jc_away_team_name_full = strval(Arr::get($item, 'jcAwayTeamNameFull'));
|
||||||
|
$match->is_reverse = intval(Arr::get($item, 'isReverse'));
|
||||||
|
|
||||||
|
// 序号是奇数为半场胜平负、序号是偶数为全场胜平负
|
||||||
|
$no = $item['no'];
|
||||||
|
if ($no % 2 == 0) {
|
||||||
|
$match->half_result = $item['result'];
|
||||||
|
} else {
|
||||||
|
$match->whole_result = $item['result'];
|
||||||
|
}
|
||||||
|
$match->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function saveSfc($data)
|
||||||
|
{
|
||||||
|
if (!$data) {
|
||||||
|
Log::error('SyncCtzq::saveSfc data is null');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach ($data as $item) {
|
||||||
|
$ctzqSfc = CtzqSfc::where('sfc_id', $item['id'])
|
||||||
|
->first();
|
||||||
|
if (!$ctzqSfc) {
|
||||||
|
$ctzqSfc = new CtzqSfc();
|
||||||
|
}
|
||||||
|
$ctzqSfc->sfc_id = $item['id'];
|
||||||
|
$ctzqSfc->issue_num = strval(Arr::get($item, 'issueNum'));
|
||||||
|
$ctzqSfc->state = strval(Arr::get($item, 'state'));
|
||||||
|
$ctzqSfc->start_time = strval(Arr::get($item, 'startTime'));
|
||||||
|
$ctzqSfc->end_time = strval(Arr::get($item, 'endTime'));
|
||||||
|
$ctzqSfc->prize_time = strval(Arr::get($item, 'prizeTime'));
|
||||||
|
$ctzqSfc->result_info = strval(Arr::get($item, 'resultInfo'));
|
||||||
|
$ctzqSfc->sale_frtn = floatval(Arr::get($item, 'salesFrtn'));
|
||||||
|
$ctzqSfc->jackpot_frtn = floatval(Arr::get($item, 'jackpotFrtn'));
|
||||||
|
$ctzqSfc->first_prize_num_frtn = intval(Arr::get($item, 'firstPrizeValFrtn'));
|
||||||
|
$ctzqSfc->first_prize_val_frtn = floatval(Arr::get($item, 'firstPrizeValue'));
|
||||||
|
$ctzqSfc->second_prize_num_frtn = intval(Arr::get($item, 'secondPrizeNumFrtn'));
|
||||||
|
$ctzqSfc->second_prize_val_frtn = floatval(Arr::get($item, 'secondPrizeValFrtn'));
|
||||||
|
$ctzqSfc->sale_nine = floatval(Arr::get($item, 'salesNine'));
|
||||||
|
$ctzqSfc->jackpot_nine = floatval(Arr::get($item, 'jackpotNine'));
|
||||||
|
$ctzqSfc->first_prize_num_nine = intval(Arr::get($item, 'firstPrizeNumNine'));
|
||||||
|
$ctzqSfc->first_prize_val_nine = floatval(Arr::get($item, 'firstPrizeValNine'));
|
||||||
|
$ctzqSfc->matchs = Arr::get($item, 'matchs', []);
|
||||||
|
$ctzqSfc->save();
|
||||||
|
$this->saveCtzqSfcMatches($ctzqSfc,Arr::get($item, 'matchs', []));
|
||||||
|
|
||||||
|
// 如果win
|
||||||
|
if ($ctzqSfc->result_info) {
|
||||||
|
RefreshOrderCtzqSfc9Result::dispatch($ctzqSfc->id);
|
||||||
|
RefreshOrderCtzqSfc14Result::dispatch($ctzqSfc->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function saveCtzqSfcMatches(CtzqSfc $ctzqSfc, $matches)
|
||||||
|
{
|
||||||
|
if (!$matches) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($matches as $item) {
|
||||||
|
$match = CtzqSfcMatch::where('ctzq_sfc_id', $ctzqSfc->id)->where('match_id', $item['matchId'])->first();
|
||||||
|
if (!$match) {
|
||||||
|
$match = new CtzqSfcMatch();
|
||||||
|
}
|
||||||
|
$match->ctzq_sfc_id = $ctzqSfc->id;
|
||||||
|
$match->no = $item['no'];
|
||||||
|
$match->match_id = $item['matchId'];
|
||||||
|
$match->jc_home_team_name = strval(Arr::get($item, 'jcHomeTeamName'));
|
||||||
|
$match->jc_home_team_name_full = strval(Arr::get($item, 'jcHomeTeamNameFull'));
|
||||||
|
$match->jc_away_team_name = strval(Arr::get($item, 'jcAwayTeamName'));
|
||||||
|
$match->jc_away_team_name_full = strval(Arr::get($item, 'jcAwayTeamNameFull'));
|
||||||
|
$match->is_reverse = intval(Arr::get($item, 'isReverse'));
|
||||||
|
$match->result = strval(Arr::get($item, 'result'));
|
||||||
|
$match->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,109 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Zq;
|
||||||
|
|
||||||
|
use App\Jobs\RefreshOrderGuanResult;
|
||||||
|
use App\Model\Zq\JczqGuan;
|
||||||
|
use App\Model\Zq\JczqGuanOdds;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class SyncGuan extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'zq:sync_guan';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '竞彩足球冠军数据';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$this->syncOdds();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function syncOdds()
|
||||||
|
{
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$odds = $alStatService->getZqGuan();
|
||||||
|
if (!$odds) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($odds as $item) {
|
||||||
|
$id = $item['id'];
|
||||||
|
$odd = JczqGuan::where('guan_id', $id)->first();
|
||||||
|
if (!$odd) {
|
||||||
|
$odd = new JczqGuan();
|
||||||
|
}
|
||||||
|
$options = Arr::get($item, 'options');
|
||||||
|
$odd->guan_id = $id;
|
||||||
|
$odd->competition = intval(Arr::get($item, 'competition'));
|
||||||
|
$odd->competition_name = strval(Arr::get($item, 'competitionName'));
|
||||||
|
$odd->season = strval(Arr::get($item, 'season'));
|
||||||
|
$odd->type = strval(Arr::get($item, 'type'));
|
||||||
|
$odd->sales_state = strval(Arr::get($item, 'salesState'));
|
||||||
|
$odd->lott_state = strval(Arr::get($item, 'lottState'));
|
||||||
|
$odd->close_time = strval(Arr::get($item, 'closeTime'));
|
||||||
|
$odd->options = $options;
|
||||||
|
$odd->save();
|
||||||
|
$this->saveGuanOdds($odd->id, $options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function saveGuanOdds($jczqGuanId, $options)
|
||||||
|
{
|
||||||
|
if (!is_array($options)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($options as $item) {
|
||||||
|
$id = $item['id'];
|
||||||
|
$odd = JczqGuanOdds::where('odds_id', $id)->where('jczq_guan_id', $jczqGuanId)->first();
|
||||||
|
if (!$odd) {
|
||||||
|
$odd = new JczqGuanOdds();
|
||||||
|
}
|
||||||
|
$odd->jczq_guan_id = $jczqGuanId;
|
||||||
|
$odd->odds_id = $id;
|
||||||
|
$odd->team_id = intval(Arr::get($item, 'teamId'));
|
||||||
|
$odd->team_name = strval(Arr::get($item, 'teamName'));
|
||||||
|
$odd->option_num = intval(Arr::get($item, 'optionNum'));
|
||||||
|
$odd->odds = Arr::get($item, 'odds');
|
||||||
|
$odd->season = strval(Arr::get($item, 'season'));
|
||||||
|
$odd->sales_state = strval(Arr::get($item, 'salesState'));
|
||||||
|
$odd->show_state = strval(Arr::get($item, 'showState'));
|
||||||
|
$odd->order_state = strval(Arr::get($item, 'orderState'));
|
||||||
|
$odd->save();
|
||||||
|
|
||||||
|
|
||||||
|
if ($odd->show_state == 'win' || $odd->show_state == 'out') {
|
||||||
|
Log::info('guankaijiang will dispath RefreshOrderGuanResult, guanOddsId:' .$odd->id);
|
||||||
|
RefreshOrderGuanResult::dispatch($odd->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,110 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Zq;
|
||||||
|
|
||||||
|
use App\Jobs\RefreshOrderGuanYaResult;
|
||||||
|
use App\Model\Zq\JczqGuanYa;
|
||||||
|
use App\Model\Zq\JczqGuanYaOdds;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class SyncGuanYa extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'zq:sync_guan_ya';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '竞彩足球冠亚军数据';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$this->syncOdds();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function syncOdds()
|
||||||
|
{
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$odds = $alStatService->getZqGuanYa();
|
||||||
|
if (!$odds) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($odds as $item) {
|
||||||
|
$id = $item['id'];
|
||||||
|
$odd = JczqGuanYa::where('guan_ya_id', $id)->first();
|
||||||
|
if (!$odd) {
|
||||||
|
$odd = new JczqGuanYa();
|
||||||
|
}
|
||||||
|
$options = Arr::get($item, 'options');
|
||||||
|
$odd->guan_ya_id = $id;
|
||||||
|
$odd->competition = intval(Arr::get($item, 'competition'));
|
||||||
|
$odd->competition_name = strval(Arr::get($item, 'competitionName'));
|
||||||
|
$odd->season = strval(Arr::get($item, 'season'));
|
||||||
|
$odd->type = strval(Arr::get($item, 'type'));
|
||||||
|
$odd->sales_state = strval(Arr::get($item, 'salesState'));
|
||||||
|
$odd->lott_state = strval(Arr::get($item, 'lottState'));
|
||||||
|
$odd->close_time = strval(Arr::get($item, 'closeTime'));
|
||||||
|
$odd->options = $options;
|
||||||
|
$odd->save();
|
||||||
|
$this->saveGuanOdds($odd->id, $options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function saveGuanOdds($jczqGuanYaId, $options)
|
||||||
|
{
|
||||||
|
if (!is_array($options)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($options as $item) {
|
||||||
|
$id = $item['id'];
|
||||||
|
$odd = JczqGuanYaOdds::where('odds_id', $id)->where('jczq_guan_ya_id', $jczqGuanYaId)->first();
|
||||||
|
if (!$odd) {
|
||||||
|
$odd = new JczqGuanYaOdds();
|
||||||
|
}
|
||||||
|
$odd->jczq_guan_ya_id = $jczqGuanYaId;
|
||||||
|
$odd->odds_id = $id;
|
||||||
|
$odd->team_a_id = intval(Arr::get($item, 'teamAId'));
|
||||||
|
$odd->team_a_name = strval(Arr::get($item, 'teamAName'));
|
||||||
|
$odd->team_b_id = intval(Arr::get($item, 'teamBId'));
|
||||||
|
$odd->team_b_name = strval(Arr::get($item, 'teamBName'));
|
||||||
|
$odd->option_num = intval(Arr::get($item, 'optionNum'));
|
||||||
|
$odd->odds = Arr::get($item, 'odds');
|
||||||
|
$odd->season = strval(Arr::get($item, 'season'));
|
||||||
|
$odd->sales_state = strval(Arr::get($item, 'salesState'));
|
||||||
|
$odd->show_state = strval(Arr::get($item, 'showState'));
|
||||||
|
$odd->order_state = strval(Arr::get($item, 'orderState'));
|
||||||
|
$odd->save();
|
||||||
|
|
||||||
|
if ($odd->show_state == 'win' || $odd->show_state == 'out') {
|
||||||
|
Log::info('guanyakaijiang will dispath RefreshOrderGuanYaResult, guanOddsId:' .$odd->id);
|
||||||
|
RefreshOrderGuanYaResult::dispatch($odd->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,112 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Zq;
|
||||||
|
|
||||||
|
use App\Enums\LottType;
|
||||||
|
use App\Model\LotteryType;
|
||||||
|
use App\Model\Zq\JczqOdds;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class SyncJczqOdds extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'zq:sync_jczq_odds';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
Log::info('SyncJczqOdds 足球赔率数据');
|
||||||
|
|
||||||
|
$this->syncOdds();
|
||||||
|
|
||||||
|
$sellingCount = JczqOdds::selling()->where('real_close_time', '>', date('Y-m-d H:i:s'))->count();
|
||||||
|
$lotteryType = LotteryType::withTrashed()->where('type', LottType::JCZQ)->first();
|
||||||
|
$lotteryType->info = sprintf('%d场赛事可投', $sellingCount);
|
||||||
|
$lotteryType->save();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function syncOdds() {
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$odds = $alStatService->getZqJczqOdds();
|
||||||
|
if (!$odds) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($odds as $item) {
|
||||||
|
$id = $item['id'];
|
||||||
|
$odd = JczqOdds::where('odds_id',$id)->first();
|
||||||
|
if (!$odd) {
|
||||||
|
$odd = new JczqOdds();
|
||||||
|
}
|
||||||
|
$odd->odds_id = $id;
|
||||||
|
$odd->match_id = strval(Arr::get($item, 'matchId'));
|
||||||
|
$odd->issue_num = strval(Arr::get($item, 'issueNum'));
|
||||||
|
$odd->play_num = strval(Arr::get($item, 'playNum'));
|
||||||
|
$odd->jc_competition_name = strval(Arr::get($item, 'jcComptName'));
|
||||||
|
$odd->jc_competition_name_full = strval(Arr::get($item, 'jcComptNameFull'));
|
||||||
|
$odd->jc_home_team_name = strval(Arr::get($item, 'jcHomeTeamName'));
|
||||||
|
$odd->jc_home_team_name_full = strval(Arr::get($item, 'jcHomeTeamNameFull'));
|
||||||
|
$odd->jc_away_team_name = strval(Arr::get($item, 'jcAwayTeamName'));
|
||||||
|
$odd->jc_away_team_name_full = strval(Arr::get($item, 'jcAwayTeamNameFull'));
|
||||||
|
$odd->sale_state = strval(Arr::get($item, 'salesState'));
|
||||||
|
$odd->is_reverse = strval(Arr::get($item, 'isReverse'));
|
||||||
|
$odd->real_close_time = strval(Arr::get($item, 'closeTime'));
|
||||||
|
$odd->order_state = strval(Arr::get($item, 'orderState'));
|
||||||
|
$odd->spf_odds = Arr::get($item, 'spfOdds', []);
|
||||||
|
$odd->spf_odds_last = $this->oddsLast($odd->spf_odds_last, $odd->spf_odds);
|
||||||
|
|
||||||
|
$odd->rq_odds = Arr::get($item, 'rqOdds', []);
|
||||||
|
$odd->rq_odds_last = $this->oddsLast($odd->rq_odds_last, $odd->rq_odds);
|
||||||
|
|
||||||
|
$odd->bf_odds =Arr::get($item, 'bfOdds', []);
|
||||||
|
$odd->bf_odds_last = $this->oddsLast($odd->bf_odds_last, $odd->bf_odds);
|
||||||
|
|
||||||
|
$odd->jq_odds = Arr::get($item, 'jqOdds', []);
|
||||||
|
$odd->jq_odds_last = $this->oddsLast($odd->jq_odds_last, $odd->jq_odds);
|
||||||
|
|
||||||
|
$odd->bqc_odds = Arr::get($item, 'bqcOdds', []);
|
||||||
|
$odd->bqc_odds_last = $this->oddsLast($odd->bqc_odds_last, $odd->bqc_odds);
|
||||||
|
|
||||||
|
$odd->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function oddsLast($fieldOldData, $fieldNewData) {
|
||||||
|
if (!$fieldOldData) {
|
||||||
|
return $fieldNewData;
|
||||||
|
}
|
||||||
|
foreach ($fieldNewData as $k => $v) {
|
||||||
|
if (Arr::get($fieldOldData, $k) != $v) {
|
||||||
|
return $fieldNewData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $fieldOldData;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,140 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Zq;
|
||||||
|
|
||||||
|
use App\Jobs\RefreshOrderJczqResult;
|
||||||
|
use App\Model\Zq\JczqOdds;
|
||||||
|
use App\Model\Zq\JczqResult;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class SyncJczqResult extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'zq:sync_jczq_result';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
Log::info('SyncJczqOdds 足球开奖结果');
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$odds = $alStatService->getJczqResult();
|
||||||
|
if (!$odds) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($odds as $item) {
|
||||||
|
$id = $item['jczqOddId'];
|
||||||
|
$result = JczqResult::where('odds_id',$id)->first();
|
||||||
|
if ($result) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$jczqOdds = JczqOdds::where('odds_id', $id)->first();
|
||||||
|
|
||||||
|
$issueNum = strval(Arr::get($item, 'issueNum'));
|
||||||
|
$issueNumArr = explode('/', $issueNum);
|
||||||
|
|
||||||
|
$result = new JczqResult();
|
||||||
|
$result->jczq_odds_id = $jczqOdds ? $jczqOdds->id : 0;
|
||||||
|
$result->odds_id = strval(Arr::get($item, 'jczqOddId'));
|
||||||
|
$result->match_id = strval(Arr::get($item, 'matchId'));
|
||||||
|
$result->issue_num = $issueNum;
|
||||||
|
$result->issue_date = strval(Arr::get($issueNumArr, 0));
|
||||||
|
$result->play_num = strval(Arr::get($item, 'playNum'));
|
||||||
|
$result->half_time_score = strval(Arr::get($item, 'halfTimeScore'));
|
||||||
|
$result->full_time_score = strval(Arr::get($item, 'fullTimeScore'));
|
||||||
|
$result->is_reverse = strval(Arr::get($item, 'isReverse'));
|
||||||
|
$result->lottery_state = strval(Arr::get($item, 'lottState'));
|
||||||
|
$result->lottery_time = strval(Arr::get($item, 'lotteryTime'));
|
||||||
|
|
||||||
|
$result->spf_odds = floatval(Arr::get($item, 'spfResult.resultOdds'));
|
||||||
|
$result->spf_name = strval(Arr::get($item, 'spfResult.resultName'));
|
||||||
|
$result->spf_field = strval(Arr::get($item, 'spfResult.resultField'));
|
||||||
|
|
||||||
|
$result->rq_odds = floatval(Arr::get($item, 'rqResult.resultOdds'));
|
||||||
|
$result->rq_handicap = floatval(Arr::get($item, 'rqResult.handicap'));
|
||||||
|
$result->rq_field = strval(Arr::get($item, 'rqResult.resultField'));
|
||||||
|
$result->rq_name = strval(Arr::get($item, 'rqResult.resultName'));
|
||||||
|
|
||||||
|
$result->bf_odds = floatval(Arr::get($item, 'bfResult.resultOdds'));
|
||||||
|
$result->bf_field = strval(Arr::get($item, 'bfResult.resultField'));
|
||||||
|
$result->bf_name = strval(Arr::get($item, 'bfResult.resultName'));
|
||||||
|
|
||||||
|
$result->jq_odds = floatval(Arr::get($item, 'jqResult.resultOdds'));
|
||||||
|
$result->jq_field = strval(Arr::get($item, 'jqResult.resultField'));
|
||||||
|
$result->jq_name = strval(Arr::get($item, 'jqResult.resultName'));
|
||||||
|
|
||||||
|
$result->bqc_odds = floatval(Arr::get($item, 'bqcResult.resultOdds'));
|
||||||
|
$result->bqc_field = strval(Arr::get($item, 'bqcResult.resultField'));
|
||||||
|
$result->bqc_name = strval(Arr::get($item, 'bqcResult.resultName'));
|
||||||
|
|
||||||
|
$result->save();
|
||||||
|
|
||||||
|
RefreshOrderJczqResult::dispatch($result->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
"jczqOddId" => 132484
|
||||||
|
"matchId" => 432216
|
||||||
|
"issueNum" => "2023-05-03/周三"
|
||||||
|
"playNum" => 1
|
||||||
|
"isReverse" => 0
|
||||||
|
"halfTimeScore" => "0 : 1"
|
||||||
|
"fullTimeScore" => "2 : 2"
|
||||||
|
"lottState" => "hasLottery"
|
||||||
|
"lotteryTime" => "2023-05-03 16:34:00"
|
||||||
|
"spfResult" => array:3 [▼
|
||||||
|
"resultField" => "draw"
|
||||||
|
"resultName" => "平"
|
||||||
|
"resultOdds" => 3.0
|
||||||
|
]
|
||||||
|
"rqResult" => array:4 [▼
|
||||||
|
"handicap" => -1
|
||||||
|
"resultField" => "loss"
|
||||||
|
"resultName" => "负"
|
||||||
|
"resultOdds" => 1.51
|
||||||
|
]
|
||||||
|
"bfResult" => array:3 [▼
|
||||||
|
"resultField" => "dh2a2"
|
||||||
|
"resultName" => "2:2"
|
||||||
|
"resultOdds" => 16.0
|
||||||
|
]
|
||||||
|
"jqResult" => array:3 [▼
|
||||||
|
"resultField" => "g4"
|
||||||
|
"resultName" => "4"
|
||||||
|
"resultOdds" => 7.15
|
||||||
|
]
|
||||||
|
"bqcResult" => array:3 [▼
|
||||||
|
"resultField" => "ld"
|
||||||
|
"resultName" => "负平"
|
||||||
|
"resultOdds" => 16.0
|
||||||
|
]
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Zq;
|
||||||
|
|
||||||
|
use App\Model\Zq\ZqCompetition;
|
||||||
|
use App\Model\Zq\ZqMatch;
|
||||||
|
use App\Model\Zq\ZqTeam;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
class SyncMatch extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'zq:sync_match';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
ZqCompetition::select(['id','competition_id', 'curr_season'])
|
||||||
|
->chunkById(500, function($competitions) {
|
||||||
|
foreach ($competitions as $competition) {
|
||||||
|
$this->syncMatch($competition->competition_id, $competition->curr_season);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function syncMatch($competitionId, $season) {
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$matches = $alStatService->getZqMatches($competitionId, $season);
|
||||||
|
if (!$matches) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach ($matches as $item) {
|
||||||
|
$matchId = $item['id'];
|
||||||
|
$match = ZqMatch::withTrashed()->select('id')->where('match_id', $matchId)->first();
|
||||||
|
if (!$match) {
|
||||||
|
$match = new ZqMatch();
|
||||||
|
}
|
||||||
|
$match->match_id = $matchId;
|
||||||
|
$match->competition_id = intval(Arr::get($item, 'competitionId'));
|
||||||
|
$match->competition_name = strval(Arr::get($item, 'competitionName'));
|
||||||
|
$match->season = strval(Arr::get($item, 'season'));
|
||||||
|
$match->stage = strval(Arr::get($item, 'stage'));
|
||||||
|
$match->group_id = intval(Arr::get($item, 'groupId'));
|
||||||
|
$match->group_name = strval(Arr::get($item, 'groupName'));
|
||||||
|
$match->start_time = Arr::get($item, 'startTime', null);
|
||||||
|
$match->home_team_id = intval(Arr::get($item, 'homeTeamId'));
|
||||||
|
$match->away_team_id = intval(Arr::get($item, 'awayTeamId'));
|
||||||
|
$match->home_team_name = strval(Arr::get($item, 'homeTeamName'));
|
||||||
|
$match->away_team_name = strval(Arr::get($item, 'awayTeamName'));
|
||||||
|
$match->status = intval(Arr::get($item, 'status'));
|
||||||
|
$match->half_time_score = strval(Arr::get($item, 'halfTimeScore'));
|
||||||
|
$match->full_time_score = strval(Arr::get($item, 'fullTimeScore'));
|
||||||
|
$match->extra_time_score = strval(Arr::get($item, 'extraTimeScore'));
|
||||||
|
$match->penal_score = strval(Arr::get($item, 'penalScore'));
|
||||||
|
$match->final_score = strval(Arr::get($item, 'finalScore'));
|
||||||
|
$match->win_team_id = intval(Arr::get($item, 'winTeamId'));
|
||||||
|
$match->man_id = strval(Arr::get($item, 'manId'));
|
||||||
|
$match->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Zq;
|
||||||
|
|
||||||
|
use App\Model\Zq\ZqCompetition;
|
||||||
|
use App\Model\Zq\ZqMatch;
|
||||||
|
use App\Model\Zq\ZqTeam;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class SyncMatchChange extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'zq:sync_match_change';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
const TYPE_DELETE = 'delete';
|
||||||
|
const TYPE_MODIFY = 'modify';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$matches = $alStatService->getZqMatchesChange();
|
||||||
|
if (!$matches) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach ($matches as $item) {
|
||||||
|
$matchId = $item['matchId'];
|
||||||
|
$type = Arr::get($item, 'type');
|
||||||
|
|
||||||
|
if (!in_array($type, [self::TYPE_DELETE, self::TYPE_MODIFY])) {
|
||||||
|
Log::error('SyncZqMatchChange 未知的modify type类型', $item);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($type == self::TYPE_DELETE) {
|
||||||
|
$match = ZqMatch::withTrashed()->where('match_id', $matchId)->first();
|
||||||
|
if (!$match) {
|
||||||
|
Log::error('SyncZqMatchChange withTrashed 足比赛id不存在', $item);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(!$match->trashed()) {
|
||||||
|
$match->delete();
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$match = ZqMatch::where('match_id', $matchId)->first();
|
||||||
|
if (!$match) {
|
||||||
|
Log::error('SyncZqMatchChange 足比赛id不存在', $item);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$match->status = intval(Arr::get($item, 'matchStatus'));
|
||||||
|
$match->start_time = Arr::get($item, 'matchStartTime', null);
|
||||||
|
$match->home_team_id = intval(Arr::get($item, 'homeTeamId'));
|
||||||
|
$match->away_team_id = intval(Arr::get($item, 'awayTeamId'));
|
||||||
|
$match->home_team_name = strval(Arr::get($item, 'homeTeamName'));
|
||||||
|
$match->away_team_name = strval(Arr::get($item, 'awayTeamName'));
|
||||||
|
|
||||||
|
$match->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Zq;
|
||||||
|
|
||||||
|
use App\Model\Zq\JczqScore;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
class SyncScore extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'zq:sync_score';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$scores = $alStatService->getZqScore();
|
||||||
|
|
||||||
|
if (!$scores) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach ($scores as $item) {
|
||||||
|
$id = $item['id'];
|
||||||
|
$match = JczqScore::withTrashed()->select('id')->where('score_id', $id)->first();
|
||||||
|
if (!$match) {
|
||||||
|
$match = new JczqScore();
|
||||||
|
}
|
||||||
|
$match->score_id = $id;
|
||||||
|
$match->match_id = intval(Arr::get($item, 'matchId'));
|
||||||
|
$match->elapsed = strval(Arr::get($item, 'elapsed'));
|
||||||
|
$match->status = intval(Arr::get($item, 'status'));
|
||||||
|
$match->period = intval(Arr::get($item, 'period'));
|
||||||
|
$match->score = strval(Arr::get($item, 'score'));
|
||||||
|
$match->half_time_score = strval(Arr::get($item, 'halfTimeScore'));
|
||||||
|
$match->full_time_score = strval(Arr::get($item, 'fullTimeScore'));
|
||||||
|
$match->extra_time_score = strval(Arr::get($item, 'extraTimeScore'));
|
||||||
|
$match->penal_score = strval(Arr::get($item, 'penalScore'));
|
||||||
|
$match->win_team_id = intval(Arr::get($item, 'winTeamId'));
|
||||||
|
$match->home_team_red_cards = intval(Arr::get($item, 'homeTeamRedNum'));
|
||||||
|
$match->away_team_red_cards = intval(Arr::get($item, 'awayTeamRedNum'));
|
||||||
|
$match->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Zq;
|
||||||
|
|
||||||
|
use App\Model\Zq\ZqCompetition;
|
||||||
|
use App\Model\Zq\ZqTeam;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
class SyncTeam extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'zq:sync_team';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
|
||||||
|
// ZqCompetition::select(['id','competition_id', 'curr_season'])
|
||||||
|
//// ->where('id', 3)
|
||||||
|
// ->chunkById(500, function($competitions) {
|
||||||
|
// foreach ($competitions as $competition) {
|
||||||
|
// $this->syncTeam($competition->competition_id, '');
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$teams = $alStatService->getZqTeam();
|
||||||
|
if (!$teams) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach ($teams as $item) {
|
||||||
|
$teamId = $item['id'];
|
||||||
|
$team = ZqTeam::where('team_id', $teamId)->first();
|
||||||
|
if (!$team) {
|
||||||
|
$team = new ZqTeam();
|
||||||
|
}
|
||||||
|
$team->team_id = $teamId;
|
||||||
|
$team->competition_id = intval(Arr::get($item, 'competitionId'));
|
||||||
|
$team->name = strval(Arr::get($item, 'name'));
|
||||||
|
$team->name_full = strval(Arr::get($item, 'nameFull'));
|
||||||
|
$team->name_en = strval(Arr::get($item, 'nameEn'));
|
||||||
|
$team->name_en_full = strval(Arr::get($item, 'nameEnFull'));
|
||||||
|
$team->team_type = strval(Arr::get($item, 'teamType'));
|
||||||
|
$team->league_id = intval(Arr::get($item, 'leagueId'));
|
||||||
|
$team->country = strval(Arr::get($item, 'country'));
|
||||||
|
$team->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Zq;
|
||||||
|
|
||||||
|
use App\Model\Zq\ZqCompany;
|
||||||
|
use App\Service\External\AlStatService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
class SyncZqCompany extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 这个就是命令名称
|
||||||
|
*/
|
||||||
|
protected $signature = 'zq:sync_zq_company';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的说明描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建命令的构造方法。
|
||||||
|
* @param string $words 传入的字符参数
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令的具体执行触发方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
/** @var AlStatService $alStatService */
|
||||||
|
$alStatService = app(AlStatService::class);
|
||||||
|
$companies = $alStatService->getZqCompany();
|
||||||
|
if (!$companies) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($companies as $item) {
|
||||||
|
$company = ZqCompany::where('company_id', $item['id'])->first();
|
||||||
|
if (!$company) {
|
||||||
|
$company = new ZqCompany();
|
||||||
|
}
|
||||||
|
$company->company_id = $item['id'];
|
||||||
|
$company->name = strval(Arr::get($item, 'name'));
|
||||||
|
$company->country = strval(Arr::get($item, 'country'));
|
||||||
|
$company->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue