Browse Source

openName name

shish 6 years ago
parent
commit
035f82a534

File diff suppressed because it is too large
+ 511 - 511
app/saas/controllers/WxController.php


+ 1 - 1
app/saas/widgets/views/footer.php

@@ -3,7 +3,7 @@
 				<div class="footer-inner">	
 					<!-- Add your copyright text here -->
 					<div class="footer-text">
-						&copy; <?= date("Y") ?> <a href="<?= Yii::$app->params['wwwUrl'] ?>" target="_blank"><?= $open['openName'] ?></a>
+						&copy; <?= date("Y") ?> <a href="<?= Yii::$app->params['wwwUrl'] ?>" target="_blank"><?= $open['name'] ?></a>
 					</div>
 					<!-- Go to Top Link, just add rel="go-top" to any link to add this functionality -->
 					<div class="go-up">

+ 71 - 72
common/components/sms.php

@@ -9,88 +9,87 @@ use Yii;
 /**
  * 短信接口
  *
-
-平台系统发短信
-考虑短信总数是否足够
-平台客户发短信需要限制IP和数量(user_id)
-
-商家发短信
-考虑总条数
-考虑商家短信是否充值
-
-商家系统发短信息不需要限制IP和数量
-
-商家的客户发短信需要限制IP和数量
-
+ *
+ * 平台系统发短信
+ * 考虑短信总数是否足够
+ * 平台客户发短信需要限制IP和数量(user_id)
+ *
+ * 商家发短信
+ * 考虑总条数
+ * 考虑商家短信是否充值
+ *
+ * 商家系统发短信息不需要限制IP和数量
+ *
+ * 商家的客户发短信需要限制IP和数量
  * 如果平台余额充足,分不限制和根据ip数量限制二种
  * 如果商家余额充足,分不限制和根据ip数量限制二种
  * 如果不足就记录一下,不要发送
  */
 class sms
 {
-	//短信服务帐号
-	const ACCOUNT = 'N2890342';
-	//短信服务密码
-	const PASSWORD = 'abc178c7';
+    //短信服务帐号
+    const ACCOUNT = 'N2890342';
+    //短信服务密码
+    const PASSWORD = 'abc178c7';
+
+    //每个用户每天可以申请的短信数量
+    const LIMIT = 15;
+
+    //商家发短信 shish 2019.12.24
+    public static function merchantSend($mobile, $msg, $merchant)
+    {
+        $merchantId = $merchant['id'];
+        $asset = MerchantAssetService::getByMerchantId($merchantId, true);
+        $remainSmsNum = $asset->remainSmsNum;
+        if ($remainSmsNum <= 0) {
+            Yii::info($merchant['merchantName'] . '短信余额不足');
+            return false;
+        }
+        $asset->remainSmsNum = --$remainSmsNum;
+        $asset->save();
+        self::freeSend($mobile, $msg, $merchant);
+    }
+
+    //自由发短,无ip和数量限制 shish 2019.12.24
+    public static function freeSend($mobile, $msg, $merchant = null)
+    {
+        $open = WxOpenService::getById(1);
+        $name = isset($open['name']) ? $open['name'] : '花卉宝';
+        $sms = new chuanglanSMS(self::ACCOUNT, self::PASSWORD);
+        $sign = isset($merchant) == true ? "【{$merchant['merchantName']}】" : "【{$name}】";
+        $msg .= $sign;
+        $sms->send($mobile, $msg);
+    }
 
-	//每个用户每天可以申请的短信数量
-	const LIMIT = 15;
+    //发短信,有ip和用户数量限制 shish 2020.2.27
+    public static function send($mobile, $msg, $merchant = null)
+    {
+        $open = WxOpenService::getOpen();
+        $name = isset($open['name']) ? $open['name'] : '花卉宝';
+        $sms = new chuanglanSMS(self::ACCOUNT, self::PASSWORD);
+        $sign = isset($merchant) == true ? "【{$merchant['merchantName']}】" : "【{$name}】";
+        $msg .= $sign;
 
-	//商家发短信 shish 2019.12.24
-	public static function merchantSend($mobile, $msg, $merchant)
-	{
-		$merchantId = $merchant['id'];
-		$asset = MerchantAssetService::getByMerchantId($merchantId, true);
-		$remainSmsNum = $asset->remainSmsNum;
-		if ($remainSmsNum <= 0) {
-			Yii::info($merchant['merchantName'] . '短信余额不足');
-			return false;
-		}
-		$asset->remainSmsNum = --$remainSmsNum;
-		$asset->save();
-		self::freeSend($mobile, $msg, $merchant);
-	}
-	
-	//自由发短,无ip和数量限制 shish 2019.12.24
-	public static function freeSend($mobile, $msg, $merchant = null)
-	{
-		$open = WxOpenService::getById(1);
-		$openName = $open['openName'];
-		$sms = new chuanglanSMS(self::ACCOUNT, self::PASSWORD);
-		$sign = isset($merchant) == true ? "【{$merchant['merchantName']}】" : "【{$openName}】";
-		$msg .= $sign;
-		$sms->send($mobile, $msg);
-	}
+        //验证是否有权限发短信
+        $uniqueId = isset($merchant['id']) ? $merchant['id'] : 1;
+        $ip = httpUtil::ip();
 
-	//发短信,有ip和用户数量限制 shish 2020.2.27
-	public static function send($mobile, $msg, $merchant = null)
-	{
-		$open = WxOpenService::getById(1);
-		$openName = $open['openName'];
-		$sms = new chuanglanSMS(self::ACCOUNT, self::PASSWORD);
-		$sign = isset($merchant) == true ? "【{$merchant['merchantName']}】" : "【{$openName}】";
-		$msg .= $sign;
+        $statusKey = 'SMS_STATUS_' . $uniqueId . '_' . $ip;
+        $hasSend = Yii::$app->redis->executeCommand('GET', [$statusKey]);
+        if (!empty($hasSend)) {
+            util::fail('请60秒后再操作');
+        }
 
-		//验证是否有权限发短信
-		$uniqueId = isset($merchant['id']) ? $merchant['id'] : 1;
-		$ip = httpUtil::ip();
+        $todayKey = 'SMS_NUM_' . date("Ymd") . '_' . $uniqueId . '_' . $ip;
+        $num = Yii::$app->redis->executeCommand('GET', [$todayKey]);
+        $num = is_numeric($num) ? $num : 0;
+        if ($num > self::LIMIT) {
+            util::fail('您今天申请的短信条数达到上限');
+        }
 
-		$statusKey = 'SMS_STATUS_' . $uniqueId . '_' . $ip;
-		$hasSend = Yii::$app->redis->executeCommand('GET', [$statusKey]);
-		if (!empty($hasSend)) {
-			util::fail('请60秒后再操作');
-		}
-		
-		$todayKey = 'SMS_NUM_' . date("Ymd") . '_' . $uniqueId . '_' . $ip;
-		$num = Yii::$app->redis->executeCommand('GET', [$todayKey]);
-		$num = is_numeric($num) ? $num : 0;
-		if ($num > self::LIMIT) {
-			util::fail('您今天申请的短信条数达到上限');
-		}
+        Yii::$app->redis->executeCommand('SETEX', [$statusKey, 60, 'hasSend']);
+        Yii::$app->redis->executeCommand('SETEX', [$todayKey, 86400, ++$num]);
+        $sms->send($mobile, $msg);
+    }
 
-		Yii::$app->redis->executeCommand('SETEX', [$statusKey, 60, 'hasSend']);
-		Yii::$app->redis->executeCommand('SETEX', [$todayKey, 86400, ++$num]);
-		$sms->send($mobile, $msg);
-	}
-	
 }

+ 2 - 2
common/services/xhCommonService.php

@@ -15,9 +15,9 @@ class xhCommonService {
 	{
 		$openId			= configDict::getConfig('openId');
 		$open			= xhWxOpenService::getById($openId);
-		$openName		= $open['openName'];
+		$name		= $open['name'];
 		$sms			= new chuanglanSMS('N2890342','abc178c7');
-		$sign			= isset($merchant) == true ? "【{$merchant['merchantName']}】" : "【{$openName}】"; 
+		$sign			= isset($merchant) == true ? "【{$merchant['merchantName']}】" : "【{$name}】"; 
 		$msg			.= $sign;  
 		$result			= $sms->send($mobile,$msg);
 	}

+ 6 - 6
console/controllers/ShellController.php

@@ -48,17 +48,17 @@ class ShellController extends Controller
 	{
 		$openId = configDict::getConfig('openId');
 		$open = xhWxOpenService::getById($openId);
-		$openName = $open['openName'];
+		$name = $open['name'];
 		$mail = Yii::$app->mailer->compose();
 		$errFile = '/opt/shell/log/week_err_' . date("Ymd") . '.txt';
 		$infoFile = '/opt/shell/log/week_info_' . date("Ymd") . '.txt';
 		$mail->setTo('479439056@qq.com');
-		$mail->setSubject("【{$openName}】《每周》脚本执行 SUCCESS(" . $ip . ")");
+		$mail->setSubject("【{$name}】《每周》脚本执行 SUCCESS(" . $ip . ")");
 		$mail->setTextBody('详细情况请查看附件哦');
 		if (file_exists($errFile) && filesize($errFile) > 0) {
 			$content = trim(file_get_contents($errFile));
 			if ($content != "Warning: Using a password on the command line interface can be insecure.") {
-				$mail->setSubject("【{$openName}】《每周》脚本执行 出错了(" . $ip . ")");
+				$mail->setSubject("【{$name}】《每周》脚本执行 出错了(" . $ip . ")");
 				$mail->attach($errFile);
 			}
 		}
@@ -75,15 +75,15 @@ class ShellController extends Controller
 	{
 		$openId = configDict::getConfig('openId');
 		$open = xhWxOpenService::getById($openId);
-		$openName = $open['openName'];
+		$name = $open['name'];
 		$mail = Yii::$app->mailer->compose();
 		$errFile = '/opt/shell/log/day_err_' . date("Ymd") . '.txt';
 		$infoFile = '/opt/shell/log/day_info_' . date("Ymd") . '.txt';
 		$mail->setTo('479439056@qq.com');
-		$mail->setSubject("【{$openName}】【每天】脚本执行 SUCCESS(" . $ip . ")");
+		$mail->setSubject("【{$name}】【每天】脚本执行 SUCCESS(" . $ip . ")");
 		$mail->setTextBody('具体请看附件哦');
 		if (file_exists($errFile) && filesize($errFile) > 0) {
-			$mail->setSubject("【{$openName}】【每天】脚本执行 出错了(" . $ip . ")");
+			$mail->setSubject("【{$name}】【每天】脚本执行 出错了(" . $ip . ")");
 			$mail->attach($errFile);
 		}
 		if (file_exists($infoFile) && filesize($infoFile) > 0) {

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