51 lines
1.5 KiB
PHP
51 lines
1.5 KiB
PHP
<?php
|
|
/*
|
|
* @author: liudiao
|
|
* @Date: 2023-02-28 16:23:31
|
|
* @Description:
|
|
*/
|
|
|
|
namespace member\modules\v1\controllers;
|
|
|
|
|
|
use common\jobs\OrderRefundJob;
|
|
use common\models\oldDb\Disease;
|
|
use common\models\oldDb\Drug;
|
|
use Overtrue\Pinyin\Pinyin;
|
|
|
|
|
|
class TestController extends \yii\web\Controller
|
|
{
|
|
public $enableCsrfValidation = false;
|
|
|
|
public function actionTest()
|
|
{
|
|
\Yii::$app->queue->delay(0)->push(new OrderRefundJob([
|
|
'orderId' => 11,
|
|
]));
|
|
}
|
|
|
|
|
|
public function actionGetPinyin(){
|
|
$type = \Yii::$app->request->post('type');
|
|
$pinyin = new Pinyin();
|
|
if($type == 'drug'){
|
|
$drug = Drug::find()->where(['pinyin_simple' => null])->limit(2000)->asArray()->all();
|
|
$num = 0;
|
|
foreach($drug as $k=>$v){
|
|
\Yii::$app->db->createCommand()->update('yii_drug', ['pinyin_simple' =>$pinyin->abbr($v['drug_name'])], ['id' => $v['id']])->execute();
|
|
$num++;
|
|
}
|
|
return ['获取药品首拼完成,共'.$num.'药品'];
|
|
} else {
|
|
$disease = Disease::find()->where(['pinyin' => null])->limit(3000)->asArray()->all();
|
|
$num = 0;
|
|
foreach($disease as $k=>$v){
|
|
\Yii::$app->db->createCommand()->update('yii_disease', ['pinyin' =>$pinyin->abbr($v['name'])], ['id' => $v['id']])->execute();
|
|
$num++;
|
|
}
|
|
return ['获取诊断首拼完成,共'.$num.'诊断'];
|
|
}
|
|
}
|
|
|
|
} |