edit修改相关内容

This commit is contained in:
admin 2023-11-22 20:10:26 +08:00
parent 40ef83d9b4
commit 21160e9e3f
124 changed files with 16108 additions and 5202 deletions

View File

@ -7,6 +7,7 @@
namespace app\commands;
use app\components\SiteHelper;
use app\models\Activity;
use app\models\ActivityUserLog;
use app\models\ActivityUserPrize;
@ -14,8 +15,12 @@ use app\models\ActivityUserRate;
use app\models\BallCart;
use app\models\BallMark;
use app\models\Order;
use app\models\Report;
use app\models\UserCoupon;
use app\models\UserOauth;
use app\models\wechat\WechatApp;
use app\modules\api\components\Mqtt;
use Wechat\Wechat;
use yii\console\Controller;
use yii\console\ExitCode;
use \PhpMqtt\Client\MQTTClient;
@ -68,125 +73,104 @@ class Script1minController extends Controller
*/
public function ActivityData(){
try{
$activity = Activity::find()->andWhere([
'status' => 1,
'is_delete' => 0,
])->andWhere([
'<=','start_time',time()
])->andWhere([
'>=','end_time',time()
])->asArray()->all();
var_dump($activity);
foreach ($activity as $k=>$v){
$activity[$k]['data'] = json_decode($v['data'],true);
}
// 获取未执行数据
$select = ActivityUserLog::find()->andWhere([
'status' => 1,
'is_delete' => 0,
$select = Report::find()->andWhere([
'step' => 2,
])->all();
if(empty($select)){
return False;
}
foreach ($select as $key=>$val){
if(empty($activity)){
$val->delete();
$json_de = json_decode($val['json'],true);
// 如果模型没有上传,则状态变更为未完成
if(empty($json_de['left_img']) || empty($json_de['right_img'])){
$val->step = 0;
$val->save();
continue;
}
$json_de = json_decode($val['data'],true);
if($json_de['type'] === 1){
// 获取订单数据
$find_order = Order::findOne([
'id' => $json_de['data'],
]);
if(empty($find_order)){
$val->delete();
continue;
}
if(empty($find_order->is_pay)){// 未支付
continue;
}
if(!empty($find_order->is_delete)){// 被删除
$val->delete();
continue;
}
if($find_order->cancel_status == 2){//进行申请退款
continue;
}
if($find_order->cancel_status === 1){//退款成功
$val->delete();
continue;
}
foreach ($activity as $k=>$v){
if(floatval($v['data']['pz']['order_min_money']) > $find_order->total_pay_price){
// 订单实付金额小于设置金额,跳过,下一个
continue;
}
// 添加数据
$find_rate = ActivityUserRate::findOne([
'user_id' => $val->user_id,
'activity_id' => $v['id'],
'is_delete' => 0,
]);
if(empty($find_rate)){
$find_rate = new ActivityUserRate();
$find_rate->user_id = $val->user_id;
$find_rate->activity_id = $v['id'];
$find_rate->rate = 0;
$find_rate->created_at = time();
$find_rate->is_delete = 0;
$find_rate->deleted_at = 0;
}
$find_rate->all_rate = intval($v['data']['pz']['data']);
$find_rate->rate += 1;
$find_rate->updated_at = time();
if($find_rate->all_rate <= $find_rate->rate){
// 可以领奖
// 获取获奖次数
$count_prize = ActivityUserPrize::find()->andWhere([
'activity_id' => $v['id'],
'user_id' => $val->user_id,
'is_delete' => 0,
])->count()??0;
if($count_prize < intval($v['data']['user_max'])){
if(!empty($v['data']['prize_arr'])){
foreach ($v['data']['prize_arr'] as $k1=>$v1){
// 奖项数据
for($i=0;$i<intval($v1['num']);$i++){
$obj_coupon = new UserCoupon();
$obj_coupon->user_id = $val->user_id;
$obj_coupon->coupon_id = $v1['id'];
$obj_coupon->status = 0;
$obj_coupon->created_at = time();
$obj_coupon->updated_at = time();
$obj_coupon->is_delete = 0;
$obj_coupon->deleted_at = 0;
$obj_coupon->is_admin_send = 1;
$obj_coupon->save();
}
}
}
// 进行领奖
$obj_prize = new ActivityUserPrize();
$obj_prize->user_id = $val->user_id;
$obj_prize->activity_id = $v['id'];
$obj_prize->data = json_encode($v['data']['prize_arr'],JSON_UNESCAPED_UNICODE);
$obj_prize->created_at = time();
$obj_prize->updated_at = time();
$obj_prize->is_delete = 0;
$obj_prize->deleted_at = 0;
$obj_prize->save();
// 更新最后的进度
$find_rate->rate = 0;
$find_rate->updated_at = time();
}
}
$find_rate->save();
}
if(!empty($json_de['updated_at']) && $json_de['updated_at']+5 > time()){
# 暂时不生成报告
continue;
}
// 变更为已执行完成
$val->status = 2;
// 判断模型文件名称
$left_img = explode('/',$json_de['left_img']);
$end = explode('.',end($left_img));
$two = explode('-',$end[0]);
$json_de['left_id'] = $two[1]??0;
$right_img = explode('/',$json_de['right_img']);
$end = explode('.',end($right_img));
$two = explode('-',$end[0]);
$json_de['right_id'] = $two[1]??0;
$val->json = json_encode($json_de,JSON_UNESCAPED_UNICODE);
$val->step = 3;
$val->save();
// 查找此用户绑定的openid
$user_oauth = UserOauth::findOne([
'user_id' => $val->user_id,
]);
if(empty($user_oauth)){
continue;
}
// 获取门店名称
$find_store = Store::findOne([
'id' => $val->store_id,
]);
// 推送客服消息
$wechat_app = WechatApp::findOne([
'cx_mch_id' => 0,
'is_delete' => 0
]);
if($wechat_app){
if (!is_dir(\Yii::$app->runtimePath . '/pem')) {
mkdir(\Yii::$app->runtimePath . '/pem');
file_put_contents(\Yii::$app->runtimePath . '/pem/index.html', '');
}
$cert_pem_file = null;
if ($wechat_app->cert_pem) {
$cert_pem_file = \Yii::$app->runtimePath . '/pem/' . md5($wechat_app->cert_pem);
if (!file_exists($cert_pem_file))
file_put_contents($cert_pem_file, $wechat_app->cert_pem);
}
$key_pem_file = null;
if ($wechat_app->key_pem) {
$key_pem_file = \Yii::$app->runtimePath . '/pem/' . md5($wechat_app->key_pem);
if (!file_exists($key_pem_file))
file_put_contents($key_pem_file, $wechat_app->key_pem);
}
$wechat_mp = new Wechat([
'appId' => $wechat_app->app_id,
'appSecret' => $wechat_app->app_secret,
'mchId' => $wechat_app->mch_id,
'apiKey' => $wechat_app->key,
'certPem' => $cert_pem_file,
'keyPem' => $key_pem_file,
]);
// 推送客服消息
$url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=".$wechat_mp->getAccessToken();
$to_url = urlencode(SiteHelper::getCustomiseOptionByKey("siteDomain", "hump")."/site/todata");
$state = $val->id;
$res_url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$wechat_app->app_id}&redirect_uri={$to_url}&response_type=code&scope=snsapi_userinfo&state={$state}#wechat_redirect";
try{
$to_user = $user_oauth->openid;
}catch (\Exception $e){
$to_user = $user_oauth->openid;
}
$arr = [
'touser' => $to_user,
'msgtype' => 'news',
'news' => [
'articles' => [
[
'title' => '您的报告已生成',
'description' => '请点击查看您的报告 - '.$find_store->name,
'url' => $res_url,
'picurl' => SiteHelper::getCustomiseOptionByKey("siteDomain", "hump").'/upload/0/1/upload/image/2023/1026/1698312821606159.jpg',
]
],
],
];
$wechat_mp->curl->post($url,json_encode($arr,JSON_UNESCAPED_UNICODE));
}
}
}catch (\Exception $e){
var_dump($e->getMessage());

View File

@ -12,6 +12,7 @@ $config = [
'@bower' => '@vendor/bower-asset',
'@npm' => '@vendor/npm-asset',
'@tests' => '@app/tests',
'@Wechat' => '@app/cxe/wechat/src/Wechat',
],
'components' => [
'cache' => [

View File

@ -2,6 +2,7 @@
namespace app\controllers;
use app\components\SiteHelper;
use Yii;
use yii\filters\AccessControl;
use yii\web\Response;
@ -22,11 +23,6 @@ class SiteController extends Controller
];
}
/**
* Displays homepage.
*
* @return string
*/
public function actionIndex()
{
$code = $this->request->get('code');
@ -34,11 +30,31 @@ class SiteController extends Controller
$to_state = "";
if(!empty($state)){
$explode = explode('_',$state);
if(!empty($explode) && count($explode) >= 2){
$to_state = "&dev_id={$explode[0]}&store_id={$explode[1]}";
if(!empty($explode[0])){
$to_state .= "&dev_id={$explode[0]}";
}
if(!empty($explode[1])){
$to_state .= "&store_id={$explode[1]}";
}
if(!empty($explode[2])){
$to_state .= "&time={$explode[2]}";
}
}
$url = "https://app.3dxh.h5.dev.1nww.com/#/White?code={$code}{$to_state}";
$url = SiteHelper::getCustomiseOptionByKey("siteWapDomain", "hump")."/#/White?code={$code}{$to_state}";
// echo $url;
// exit();
return $this->redirect($url);
}
public function actionTodata()
{
$code = $this->request->get('code');
$state = $this->request->get('state');
$to_state = "";
if(!empty($state)){
$to_state = "&id={$state}";
}
$url = SiteHelper::getCustomiseOptionByKey("siteWapDomain", "hump")."/#/dataReporting?code={$code}{$to_state}";
// echo $url;
// exit();
return $this->redirect($url);

View File

@ -11,7 +11,9 @@
*/
namespace app\controllers;
use app\components\SiteHelper;
use app\models\Dev;
use app\models\Store;
use app\models\wechat\WechatApp;
use app\modules\api\behaviors\LoginBehavior;
use app\models\common\CommonAddressActionForm;
@ -108,6 +110,10 @@ class WechatController extends Controller
if(empty($find)){
return false;
}
// 查找门店
$find_store = Store::findOne([
'id' => $find->store_id,
]);
$wechat_mp = "";
$wechat_app = WechatApp::findOne([
'cx_mch_id' => 0,
@ -140,8 +146,8 @@ class WechatController extends Controller
]);
// 推送客服消息
$url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=".$wechat_mp->getAccessToken();
$to_url = urlencode(\Yii::$app->request->getHostInfo()."/site");
$state = $find->id."_".$find->store_id;
$to_url = urlencode(SiteHelper::getCustomiseOptionByKey("siteDomain", "hump")."/site");
$state = $find->id."_".$find->store_id."_".time();
$res_url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$wechat_app->app_id}&redirect_uri={$to_url}&response_type=code&scope=snsapi_userinfo&state={$state}#wechat_redirect";
try{
$to_user = reset($request_xml->FromUserName);
@ -154,20 +160,21 @@ class WechatController extends Controller
'news' => [
'articles' => [
[
'title' => '333',
'description' => '23432432',
'title' => '欢迎访问'.SiteHelper::getCustomiseOptionByKey("siteName", "hump"),
'description' => "请点击访问链接,配合工作人员完成步骤 - ".$find_store->name,
'url' => $res_url,
'picurl' => \Yii::$app->request->getHostInfo().'/upload/0/1/upload/image/2023/1026/1698312821606159.jpg',
'picurl' => SiteHelper::getCustomiseOptionByKey("siteDomain", "hump").'/upload/0/1/upload/image/2023/1026/1698312821606159.jpg',
]
],
],
];
$res = $wechat_mp->curl->post($url,json_encode($arr));
$res = $wechat_mp->curl->post($url,json_encode($arr,JSON_UNESCAPED_UNICODE));
\Yii::info(json_encode($res),'wxpay');
\Yii::info(json_encode($arr).$request_xml->FromUserName,'wxpay');
}
$text = "欢迎来到英舒迪公众号";
$msg = sprintf($this->_msg_template['text'], $request_xml->FromUserName, $request_xml->ToUserName, time(),$text);
$msg = "";
}else{
}
@ -198,5 +205,57 @@ class WechatController extends Controller
return $msg;
}
/**
* @ 更新菜单
*/
public function actionUpMenu(){
$wechat_app = WechatApp::findOne([
'cx_mch_id' => 0,
'is_delete' => 0
]);
if($wechat_app){
if (!is_dir(\Yii::$app->runtimePath . '/pem')) {
mkdir(\Yii::$app->runtimePath . '/pem');
file_put_contents(\Yii::$app->runtimePath . '/pem/index.html', '');
}
$cert_pem_file = null;
if ($wechat_app->cert_pem) {
$cert_pem_file = \Yii::$app->runtimePath . '/pem/' . md5($wechat_app->cert_pem);
if (!file_exists($cert_pem_file))
file_put_contents($cert_pem_file, $wechat_app->cert_pem);
}
$key_pem_file = null;
if ($wechat_app->key_pem) {
$key_pem_file = \Yii::$app->runtimePath . '/pem/' . md5($wechat_app->key_pem);
if (!file_exists($key_pem_file))
file_put_contents($key_pem_file, $wechat_app->key_pem);
}
$wechat_mp = new Wechat([
'appId' => $wechat_app->app_id,
'appSecret' => $wechat_app->app_secret,
'mchId' => $wechat_app->mch_id,
'apiKey' => $wechat_app->key,
'certPem' => $cert_pem_file,
'keyPem' => $key_pem_file,
]);
// 推送客服消息
$url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=".$wechat_mp->getAccessToken();
$to_url = urlencode(SiteHelper::getCustomiseOptionByKey("siteDomain", "hump")."/site");
$res_url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$wechat_app->app_id}&redirect_uri={$to_url}&response_type=code&scope=snsapi_userinfo&state=#wechat_redirect";
$arr = [
'button' => [
[
'type' => 'view',
'name' => '查看报告',
'url' => $res_url,
]
],
];
$res = $wechat_mp->curl->post($url,json_encode($arr,JSON_UNESCAPED_UNICODE));
var_dump($res);
}
}
}

View File

@ -1,2 +1,2 @@
1700535696
s:136:"74_KmyxOVSr9WvpDlklucVAGhhN7X3q59Cmv3-Ovx4wqp9ShpMuGqrDkXrO_1d1ePJ95GnkNPVz8WmFvqC2ko9MvH8VSsiJBp4yebHlhMV9ky5_AkQKw42MxF3pZtISZVhAIAHOK";
1700638686
s:136:"74_wzgKRuX7SJnqE211OUU4QhcpkoTf7sW3yK4xexKr07DGUdEt6KL-XVz0i8XthAAqbwogPOgR3Sysh8Ch2RQoQUNo-AOLPBakYC9RkAm2DBo0SptQbr9xQMVQp9AFLGdACALRM";

View File

@ -19,6 +19,7 @@ use Yii;
* @property int $initial_at 门店添加时间
* @property int $final_at 医师添加时间
* @property int $pdf_at PDF添加时间
* @property string $json 其他数据
*/
class Report extends \yii\db\ActiveRecord
{
@ -38,7 +39,7 @@ class Report extends \yii\db\ActiveRecord
return [
[['user_id', 'store_id', 'model_number', 'created_at'], 'required'],
[['user_id', 'store_id', 'step', 'created_at', 'pdf_at', 'initial_at', 'final_at'], 'integer'],
[['initial_path', 'final_path', 'pdf_path'], 'string'],
[['initial_path', 'final_path', 'pdf_path','json'], 'string'],
[['model_number'], 'string', 'max' => 50],
];
}

View File

@ -31,6 +31,7 @@ class ReportController extends Controller
'login' => [
'class' => LoginBehavior::className(),
'ignore' => [
'api/report/get-info'
]
]
]);

View File

@ -67,9 +67,9 @@ class UserController extends Controller
}
// 查用户信息
$user = User::findOne(['id' => $user_outh->user_id, 'type' => 0, 'status' => 0]);
$user = User::findOne(['id' => $user_outh->user_id]);
//未绑定
if ($user == null || empty($user->mobile_phone) || empty($user->is_view)) {
if ($user == null || empty($user->mobile_phone)) {
$data = ['code' => 1, 'msg' => '未绑定'];
} else {
//已绑定
@ -108,7 +108,7 @@ class UserController extends Controller
}
/**
/**
* showdoc
* @catalog 会员注册
* @method post

View File

@ -39,12 +39,13 @@ class ReportEditForm extends ApiModel
public $user_id;
public $model_number;
public $time;
public function rules()
{
return [
[['dev_id', 'store_id'], 'integer'],
[['dev_id', 'store_id','time'], 'integer'],
[['dev_id', 'store_id'], 'required'],
];
}
@ -61,13 +62,41 @@ class ReportEditForm extends ApiModel
if ($dev == null) {
return ['code' => 1, 'msg' => '无效设备,请联系管理员'];
}
if(!empty($this->time)){
// 查询是否有数据
$find = Report::findOne([
'user_id' => $this->user_id,
'model_number' => $dev->dev_number,
'store_id' => $this->store_id,
'created_at' => $this->time,
]);
if(!empty($find)){
return ['code' => 0, 'msg' => '成功'];
}
}
if(empty($this->time)){
$this->time = time();
}
if(strlen($this->time) > 11){
$this->time = time();
}
$model = new Report();
$model->user_id = $this->user_id;
$model->model_number = $dev->dev_number;
$model->store_id = $this->store_id;
$model->created_at = time();
$model->created_at = $this->time;
$user = User::findOne([
'id' => $this->user_id
]);
$json = [
'nickname' => $user->real_name,
'gender' => $user->gender,
'age' => $user->age,
'height' => $user->height,
'weight' => $user->weight,
];
$model->json = json_encode($json,JSON_UNESCAPED_UNICODE);
if (!$model->save()) {
return Model::getModelErrorInfo($model);
}

View File

@ -39,6 +39,7 @@ class ReportForm extends ApiModel
public $user_id;
public $cx_mch_id;
public $id;
public function rules()
{
@ -115,7 +116,7 @@ class ReportForm extends ApiModel
* @description 数据列表-获取详情
*/
public function actionGetInfo(){
if(empty($id)){
if(empty($this->id)){
return $this->apiReturnError('请求错误');
}
$find = Report::findOne([
@ -128,20 +129,73 @@ class ReportForm extends ApiModel
return $this->apiReturnError('暂未生成结果');
}
$json_de = [];
$gender = [
0 => '未知',
1 => '男',
2 => '女',
];
if(!empty($find->json)){
$json_de = json_decode($find->json,true);
if(!empty($json_de['left_img'])){
if(substr($json_de['left_img'],0,1) == '/'){
$json_de['left_img'] = SiteHelper::getCustomiseOptionByKey("siteDomain", "hump").$json_de['left_img'];
}else{
$json_de['left_img'] = SiteHelper::getCustomiseOptionByKey("siteDomain", "hump").'/'.$json_de['left_img'];
}
}
if(!empty($json_de['right_img'])){
if(substr($json_de['right_img'],0,1) == '/'){
$json_de['right_img'] = SiteHelper::getCustomiseOptionByKey("siteDomain", "hump").$json_de['right_img'];
}else{
$json_de['right_img'] = SiteHelper::getCustomiseOptionByKey("siteDomain", "hump").'/'.$json_de['right_img'];
}
}
if(!empty($json_de['gender'])){
$json_de['gender_str'] = $gender[$json_de['gender']];
}
$json_de['left_data'] = $this->getData($json_de['left_id']);
$json_de['right_data'] = $this->getData($json_de['right_id']);
}
$res = $json_de??[];
$find_store = Store::findOne([
'id' => $find->store_id,
]);
$res['store'] = [
'id' => $find->store_id,
'name' => $find_store->name??'暂无门店',
$res = [
'other_data' => $json_de,
'store' => [
'id' => $find->store_id,
'name' => $find_store->name??'暂无门店',
],
'created_date' => date('Y-m-d',$find->created_at),
];
$res['created_date'] = date('Y-m-d H:i:s',$find->created_at);
return $this->apiReturnSuccess('ok',$res);
}
public function getData($key=0){
if(empty($key)){
return [];
}
$arr = [
1001 => ['buwei_1' => ['status' => '无','data' => '3%',], 'buwei_2' => ['status' => '正常足', 'data' => '--',], 'buwei_3' => ['status' => '宽脚', 'data' => '--',], 'type_ratio' => 60, 'type_str' => "正常足", 'type_content' => "正常足 :缓冲能力较佳,能够正常吸收地面冲击力,感知地面凹凸状况并及时作出调整。", 'ks_ratio' => 81, 'ks_content' => '宽瘦脚:在没有更多选择的情况下,我们只能被动的将就穿鞋。如果是宽脚会因为挤脚而选择大一码的鞋,如果是瘦脚,会因脚瘦鞋不跟脚而磨脚',], # 左脚
2001 => ['buwei_1' => ['status' => '轻度外翻', 'data' => '12%',], 'buwei_2' => ['status' => '正常足', 'data' => '--',], 'buwei_3' => ['status' => '正常足', 'data' => '--',], 'type_ratio' => 60, 'type_str' => "正常足", 'type_content' => "正常足 :缓冲能力较佳,能够正常吸收地面冲击力,感知地面凹凸状况并及时作出调整。", 'ks_ratio' => 82, 'ks_content' => '宽瘦脚:在没有更多选择的情况下,我们只能被动的将就穿鞋。如果是宽脚会因为挤脚而选择大一码的鞋,如果是瘦脚,会因脚瘦鞋不跟脚而磨脚',], # 右脚
1002 => ['buwei_1' => ['status' => '无','data' => '4%',], 'buwei_2' => ['status' => '扁平足', 'data' => '--',], 'buwei_3' => ['status' => '宽脚', 'data' => '--',], 'type_ratio' => 15, 'type_str' => "扁平足", 'type_content' => "扁平足 :出现走路疼痛、步态异常等需及时就诊。坚持肌肉肌腱拉伸,强化足部肌肉及韧带。", 'ks_ratio' => 83, 'ks_content' => '宽瘦脚:在没有更多选择的情况下,我们只能被动的将就穿鞋。如果是宽脚会因为挤脚而选择大一码的鞋,如果是瘦脚,会因脚瘦鞋不跟脚而磨脚',], # 左脚
2002 => ['buwei_1' => ['status' => '轻度外翻', 'data' => '11%',], 'buwei_2' => ['status' => '扁平足', 'data' => '--',], 'buwei_3' => ['status' => '扁平足', 'data' => '--',], 'type_ratio' => 15, 'type_str' => "扁平足", 'type_content' => "扁平足 :出现走路疼痛、步态异常等需及时就诊。坚持肌肉肌腱拉伸,强化足部肌肉及韧带。", 'ks_ratio' => 84, 'ks_content' => '宽瘦脚:在没有更多选择的情况下,我们只能被动的将就穿鞋。如果是宽脚会因为挤脚而选择大一码的鞋,如果是瘦脚,会因脚瘦鞋不跟脚而磨脚',], # 右脚
1003 => ['buwei_1' => ['status' => '无','data' => '5%',], 'buwei_2' => ['status' => '扁平足', 'data' => '--',], 'buwei_3' => ['status' => '宽脚', 'data' => '--',], 'type_ratio' => 25, 'type_str' => "扁平足", 'type_content' => "扁平足 :出现走路疼痛、步态异常等需及时就诊。坚持肌肉肌腱拉伸,强化足部肌肉及韧带。", 'ks_ratio' => 85, 'ks_content' => '宽瘦脚:在没有更多选择的情况下,我们只能被动的将就穿鞋。如果是宽脚会因为挤脚而选择大一码的鞋,如果是瘦脚,会因脚瘦鞋不跟脚而磨脚',], # 左脚
2003 => ['buwei_1' => ['status' => '轻度外翻', 'data' => '12%',], 'buwei_2' => ['status' => '扁平足', 'data' => '--',], 'buwei_3' => ['status' => '扁平足', 'data' => '--',], 'type_ratio' => 25, 'type_str' => "扁平足", 'type_content' => "扁平足 :出现走路疼痛、步态异常等需及时就诊。坚持肌肉肌腱拉伸,强化足部肌肉及韧带。", 'ks_ratio' => 86, 'ks_content' => '宽瘦脚:在没有更多选择的情况下,我们只能被动的将就穿鞋。如果是宽脚会因为挤脚而选择大一码的鞋,如果是瘦脚,会因脚瘦鞋不跟脚而磨脚',], # 右脚
1004 => ['buwei_1' => ['status' => '无','data' => '4%',], 'buwei_2' => ['status' => '高足弓', 'data' => '--',], 'buwei_3' => ['status' => '宽脚', 'data' => '--',], 'type_ratio' => 95, 'type_str' => "高足弓", 'type_content' => "高足弓 :严重的高弓足患者应该咨询专科医生的治疗意见。轻度的高弓足可以通过放松筋膜和加强薄弱肌肉来缓解症状", 'ks_ratio' => 87, 'ks_content' => '宽瘦脚:在没有更多选择的情况下,我们只能被动的将就穿鞋。如果是宽脚会因为挤脚而选择大一码的鞋,如果是瘦脚,会因脚瘦鞋不跟脚而磨脚',], # 左脚
2004 => ['buwei_1' => ['status' => '轻度外翻', 'data' => '12%',], 'buwei_2' => ['status' => '高足弓', 'data' => '--',], 'buwei_3' => ['status' => '高足弓', 'data' => '--',], 'type_ratio' => 95, 'type_str' => "高足弓", 'type_content' => "高足弓 :严重的高弓足患者应该咨询专科医生的治疗意见。轻度的高弓足可以通过放松筋膜和加强薄弱肌肉来缓解症状", 'ks_ratio' => 88, 'ks_content' => '宽瘦脚:在没有更多选择的情况下,我们只能被动的将就穿鞋。如果是宽脚会因为挤脚而选择大一码的鞋,如果是瘦脚,会因脚瘦鞋不跟脚而磨脚',], # 右脚
1005 => ['buwei_1' => ['status' => '无','data' => '3%',], 'buwei_2' => ['status' => '高足弓', 'data' => '--',], 'buwei_3' => ['status' => '宽脚', 'data' => '--',], 'type_ratio' => 85, 'type_str' => "高足弓", 'type_content' => "高足弓 :调整行走的步态。尽可能在步态的站立中期增加足部更多的旋前状态,增加中足的灵活程度", 'ks_ratio' => 89, 'ks_content' => '宽瘦脚:在没有更多选择的情况下,我们只能被动的将就穿鞋。如果是宽脚会因为挤脚而选择大一码的鞋,如果是瘦脚,会因脚瘦鞋不跟脚而磨脚',], # 左脚
2005 => ['buwei_1' => ['status' => '轻度外翻', 'data' => '11%',], 'buwei_2' => ['status' => '高足弓', 'data' => '--',], 'buwei_3' => ['status' => '高足弓', 'data' => '--',], 'type_ratio' => 85, 'type_str' => "高足弓", 'type_content' => "高足弓 :调整行走的步态。尽可能在步态的站立中期增加足部更多的旋前状态,增加中足的灵活程度", 'ks_ratio' => 90, 'ks_content' => '宽瘦脚:在没有更多选择的情况下,我们只能被动的将就穿鞋。如果是宽脚会因为挤脚而选择大一码的鞋,如果是瘦脚,会因脚瘦鞋不跟脚而磨脚',], # 右脚
1006 => ['buwei_1' => ['status' => '无','data' => '3%',], 'buwei_2' => ['status' => '低足弓', 'data' => '--',], 'buwei_3' => ['status' => '宽脚', 'data' => '--',], 'type_ratio' => 45, 'type_str' => "低足弓", 'type_content' => "低足弓 :特别注意减轻足弓压力,可以加强足跖肌锻炼屈曲足跖。", 'ks_ratio' => 91, 'ks_content' => '宽瘦脚:在没有更多选择的情况下,我们只能被动的将就穿鞋。如果是宽脚会因为挤脚而选择大一码的鞋,如果是瘦脚,会因脚瘦鞋不跟脚而磨脚',], # 左脚
2006 => ['buwei_1' => ['status' => '轻度外翻', 'data' => '11%',], 'buwei_2' => ['status' => '低足弓', 'data' => '--',], 'buwei_3' => ['status' => '低足弓', 'data' => '--',], 'type_ratio' => 45, 'type_str' => "低足弓", 'type_content' => "低足弓 :特别注意减轻足弓压力,可以加强足跖肌锻炼屈曲足跖", 'ks_ratio' => 92, 'ks_content' => '宽瘦脚:在没有更多选择的情况下,我们只能被动的将就穿鞋。如果是宽脚会因为挤脚而选择大一码的鞋,如果是瘦脚,会因脚瘦鞋不跟脚而磨脚',], # 右脚
];
return $arr[$key];
}
}

View File

@ -120,6 +120,8 @@ class UserModifyForm extends ApiModel
return $this->getModelError($user);
}
}else{
$user->real_name = $this->real_name;
$user->gender = $this->gender;
$user->updated_at = time();
$user->age = $this->age;
$user->height = $this->height;
@ -128,7 +130,7 @@ class UserModifyForm extends ApiModel
}
if ($this->openid) {
if (!empty($this->openid)) {
$user_outh = UserOauth::findOne(['openid' => $this->openid]);
if ($user_outh == null) {
$t->rollBack();

View File

@ -310,7 +310,8 @@ class Uploader
}
$ext = $this->getFileExt();
return $format . $ext;
return $format.$this->oriName . $ext;
}
/**

View File

@ -71,9 +71,12 @@ class ReportController extends Controller
$data = $form->edit();
return $this->responseHandler($data);
}
$json_de = [];
if ($model != null) {
$user = User::findOne(['id' => $model->user_id]);
if(!empty($model->json)){
$json_de = json_decode($model->json,true);
}
}
@ -86,7 +89,9 @@ class ReportController extends Controller
'return_url' => $return_url,
'user' => $user,
'storeUser' => $storeUser,
'report_name' => $report_name
'report_name' => $report_name,
'left_img' => $json_de['left_img']??'',
'right_img' => $json_de['right_img']??'',
]);
}
}

View File

@ -25,6 +25,7 @@ use app\models\User;
use app\modules\store\models\AdminModel;
use app\models\common\CommonUserEditForm;
use app\modules\api\models\StoreCityForm;
use PHPUnit\Util\Log\JSON;
use Wechat\Wechat;
class ReportEditForm extends AdminModel
@ -35,12 +36,14 @@ class ReportEditForm extends AdminModel
public $model;
public $final_path;
public $user_type;
public $left_img;
public $right_img;
public function rules()
{
return [
[['final_path'], 'string'],
[['final_path'], 'required'],
[['final_path','right_img','left_img'], 'string'],
// [['final_path'], 'required'],
];
}
@ -67,6 +70,19 @@ class ReportEditForm extends AdminModel
$this->model->step = 2;
$this->model->final_at = time();
}
$json = [];
if(!empty($this->model->json)){
$json = json_decode($this->model->json,true);
}
$json['left_img'] = $this->left_img;
$json['right_img'] = $this->right_img;
$json['updated_at'] = time();
if(!empty($this->left_img) && !empty($this->right_img)){
$this->model->step = 2;
}else{
$this->model->step = 0;
}
$this->model->json = json_encode($json,JSON_UNESCAPED_UNICODE);
if (!$this->model->save()) {
return $this->getModelError($this->model);

View File

@ -84,20 +84,30 @@ class ReportListForm extends AdminModel
$storeUser = StoreUser::findOne(['user_id' => $this->user_id]);
$gender_str = [
0 => '未知',
1 => '男',
2 => '女',
];
$status = [
0 => '待上传',
2 => '待生成报告',
3 => '报告已生成',
];
foreach ($list as $index => $item) {
if(!empty($item['json'])){
$item['json'] = json_decode($item['json'],true);
}
if(empty($item['json'])){
$item['json'] = [
'status' => 0, # 当前状态1.有报告0,
''
];
$item['json'] = json_decode('{"nickname":"","gender":0,"age":null,"height":null,"weight":null}',true);
}
$item['json']['gender_str'] = $gender_str[$item['json']['gender']]??'未知';
$item['user_type'] = $storeUser->user_type;
foreach ($item['json'] as $k=>$v){
$item["json_".$k] = $v;
}
$item['user_type'] = $storeUser->user_type;
$item['created_at_cn'] = date("Y-m-d H:i", $item['created_at']);
$item['initial_path_ext'] = "";
@ -125,6 +135,8 @@ class ReportListForm extends AdminModel
$item['pdf_path_ext'] = end($explode);
}
$item['status'] = $status[$item['step']]??'';
$list[$index] = $item;
}

View File

@ -29,7 +29,7 @@ $this->params['breadcrumbs'][] = $this->title;
<div class="layui-form-item">
<label class="layui-form-label required">姓名</label>
<div class="layui-input-inline">
<input type="text" name="phone" placeholder="请输入客服电话" autocomplete="off" class="layui-input"
<input type="text" name="phone" placeholder="请输入姓名" autocomplete="off" class="layui-input"
value="<?= $user->real_name ?>" <?= !$model->isNewRecord ? 'disabled' : '' ?>
lay-verify="required">
</div>
@ -40,7 +40,7 @@ $this->params['breadcrumbs'][] = $this->title;
<div class="layui-form-item">
<label class="layui-form-label required">模型编号</label>
<div class="layui-input-inline">
<input type="text" name="phone" placeholder="请输入客服电话" autocomplete="off" class="layui-input"
<input type="text" name="phone" placeholder="请输模型编号" autocomplete="off" class="layui-input"
value="<?= $model->model_number ?>" <?= !$model->isNewRecord ? 'disabled' : '' ?>
lay-verify="required">
</div>
@ -50,8 +50,17 @@ $this->params['breadcrumbs'][] = $this->title;
<?= PickFile::widget([
'accept' => 'file',
'id' => 'final_path_upload',
'name' => 'final_path',
'label' => $report_name,
'name' => 'left_img',
'label' => "左脚图片",
'value' => $left_img,
// 'tip' => '图片大小100px×100px'
]) ?>
<?= PickFile::widget([
'accept' => 'file',
'id' => 'final_path_upload_',
'name' => 'right_img',
'label' => "右脚图片",
'value' => $right_img,
// 'value' => SiteHelper::getCustomiseOptionByKey("siteLogo","hump"),
// 'tip' => '图片大小100px×100px'
]) ?>

View File

@ -79,7 +79,14 @@ $this->params['breadcrumbs'][] = $this->title;
<!--行操作列模板-->
<script type="text/html" id="rowBarTpl">
{{# if(d.step == 0){ }}
<button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="edit">模型上传</button>
{{# }else{ }}
<button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="edit">修改模型上传</button>
{{# } }}
{{# if(d.step == 3){ }}
<a href="https://app.3dxh.h5.dev.1nww.com/#/dataReporting?id={{d.id}}&time={{new Date().getTime()}}" target="_blank" class="layui-btn layui-btn-xs layui-btn-normal">查看报告</a>
{{# } }}
<!--{{# if(d.user_type == 1){ }}
<button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="edit">初始模型上传</button>
{{# } }}
@ -171,8 +178,13 @@ $this->params['breadcrumbs'][] = $this->title;
, {field: 'id', title: 'ID', width: 80}
, {field: 'real_name', title: '姓名', width: 100}
, {field: 'mobile_phone', title: '电话', width: 120}
, {field: "json_gender_str", title: '性别', width: 80}
, {field: "json_age", title: '年龄', width: 80}
, {field: "json_height", title: '身高', width: 80}
, {field: "json_weight", title: '体重', width: 80}
, {field: 'store_name', title: '门店名称'}
, {field: 'model_number', title: '设备编号'}
, {field: 'status', title: '状态'}
// , {field: 'initial_name', title: '初始模型'}
// , {field: 'final_name', title: '最终模型'}
// , {field: 'pdf_name', title: 'PDF报告'}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More