Esempio n. 1
0
 public static function confirmAjax($mobile, $score)
 {
     $hd201509t3 = \app\models\MHd201509t3::findOne(['mobile' => $mobile]);
     $hd201509t3->status = 1;
     //提交状态
     $hd201509t3->score = $score;
     $hd201509t3->create_time = date('y-m-d h:i:s', time());
     $hd201509t3->save(false);
     $hd201509t4 = new \app\models\MHd201509t4();
     $bm = \app\models\OpenidBindMobile::findOne(['mobile' => $mobile]);
     $hd201509t4->gh_id = $bm->gh_id;
     $hd201509t4->openid = $bm->openid;
     $hd201509t4->mobile = $mobile;
     $hd201509t4->score = $score;
     $hd201509t4->status = 1;
     $hd201509t4->create_time = date('y-m-d h:i:s', time());
     $hd201509t4->save(false);
     return \yii\helpers\Json::encode(['code' => 0]);
 }
Esempio n. 2
0
 public function actionUpdateHd201509t3m2($filename = 'xjfdax1012.csv')
 {
     $filepathname = Yii::$app->getRuntimePath() . DIRECTORY_SEPARATOR . 'imported_data' . DIRECTORY_SEPARATOR . $filename;
     $fh = fopen($filepathname, "r");
     while (!feof($fh)) {
         $line = trim(fgets($fh));
         if (empty($line) || strlen($line) == 0) {
             continue;
         }
         $fields = explode(",", $line);
         $mobile = trim($fields[0]);
         $mobile_utf8 = iconv('GBK', 'UTF-8//IGNORE', $mobile);
         $hd201509t3 = MHd201509t3::findOne(['mobile' => $mobile_utf8]);
         if (empty($hd201509t3)) {
             echo $mobile_utf8 . "\t\t" . "not found, add!\n";
             $hd201509t3 = new MHd201509t3();
             $hd201509t3->mobile = $mobile_utf8;
             $hd201509t3->status = 0;
             $hd201509t3->score = 0;
             $hd201509t3->save(false);
         } else {
             echo $mobile_utf8 . "\t\t" . "found!\t\t" . "\n";
             //$hd201509t6->qdbm = $qdbm_ok_utf8;
             //$hd201509t6->save(false);
         }
     }
     fclose($fh);
     echo "done\n";
 }
Esempio n. 3
0
 public function actionHd201509t3()
 {
     $this->layout = false;
     $gh_id = U::getSessionParam('gh_id');
     $openid = U::getSessionParam('openid');
     $wx_user = \app\models\MUser::findOne(['gh_id' => $gh_id, 'openid' => $openid]);
     if (empty($wx_user) || $wx_user->subscribe === 0) {
         return $this->render('need_subscribe');
     }
     //是否会员
     $bindMobiles = \app\models\OpenidBindMobile::findOne(['gh_id' => $gh_id, 'openid' => $openid]);
     if (empty($bindMobiles)) {
         $url = \yii\helpers\Url::to();
         \Yii::$app->getSession()->set('RETURN_URL', $url);
         return $this->redirect(['wap/addbindmobile', 'gh_id' => $gh_id, 'openid' => $openid]);
     }
     //是否在可捐献积分名单中
     $hd201509t3 = \app\models\MHd201509t3::findOne(['mobile' => $bindMobiles->mobile]);
     if (empty($hd201509t3)) {
         //return $this->render('hd201509t3_1', [
         //    'observer' => $wx_user,
         //    ]);
         //flag 0 不在名单中,不符合捐献活动条件; 1 符合
         return $this->render('hd201509t3', ['observer' => $wx_user, 'hd201509t3' => $hd201509t3, 'flag' => 0]);
     } else {
         return $this->render('hd201509t3', ['observer' => $wx_user, 'hd201509t3' => $hd201509t3, 'flag' => 1]);
     }
 }
Esempio n. 4
0
 public function actionImporthd201509t3()
 {
     $file = Yii::$app->getRuntimePath() . DIRECTORY_SEPARATOR . 'xjfdax-20150828.csv';
     $fh = fopen($file, "r");
     $i = 0;
     while (!feof($fh)) {
         $line = fgets($fh);
         if (empty($line)) {
             continue;
         }
         $arr = explode(",", $line);
         $arr[0] = iconv('GBK', 'UTF-8//IGNORE', $arr[0]);
         $mobile = trim($arr[0]);
         echo $mobile . "\n";
         $hd201509t3 = MHd201509t3::findOne(['mobile' => $mobile]);
         if (!empty($hd201509t3)) {
             //U::W("mobile=$mobile already exists");
             //U::W($arr);
         } else {
             $hd201509t3 = new MHd201509t3();
         }
         $hd201509t3->mobile = $mobile;
         $hd201509t3->save(false);
         $i++;
         if ($i % 1000 == 1) {
             U::W($i);
         }
     }
     fclose($fh);
 }