|
|
@@ -38,7 +38,6 @@ class util
|
|
|
|
|
|
/**
|
|
|
* 生成缩略图
|
|
|
- * @author yangzhiguo0903@163.com
|
|
|
* @param string 源图绝对完整地址{带文件名及后缀名}
|
|
|
* @param string 目标图绝对完整地址{带文件名及后缀名}
|
|
|
* @param int 缩略图宽{0:此时目标高度不能为0,目标宽度为源图宽*(目标高度/源图高)}
|
|
|
@@ -46,6 +45,7 @@ class util
|
|
|
* @param int 是否裁切{宽,高必须非0}
|
|
|
* @param int /float 缩放{0:不缩放, 0<this<1:缩放到相应比例(此时宽高限制和裁切均失效)}
|
|
|
* @return boolean
|
|
|
+ * @author yangzhiguo0903@163.com
|
|
|
*/
|
|
|
public static function img2thumb($src_img, $dst_img, $width = 75, $height = 75, $cut = 0, $proportion = 0)
|
|
|
{
|
|
|
@@ -285,6 +285,16 @@ class util
|
|
|
self::encode(['code' => 0, 'msg' => $msg, 'data' => []]);
|
|
|
}
|
|
|
|
|
|
+ public static function mistake($msg = '操作失败', $mask = false, $icon = 'none', $duration = 1500)
|
|
|
+ {
|
|
|
+ $report = isset(Yii::$app->params['errorReport']) ? Yii::$app->params['errorReport'] : 0;
|
|
|
+ if ($report == 1) {
|
|
|
+ throw new \Exception($msg);
|
|
|
+ return fale;
|
|
|
+ }
|
|
|
+ self::encode(['code' => 0, 'msg' => $msg, 'data' => [], 'mask' => $mask, 'icon' => $icon, 'duration' => $duration]);
|
|
|
+ }
|
|
|
+
|
|
|
//错误输出,带自定义code
|
|
|
public static function error($code, $msg)
|
|
|
{
|
|
|
@@ -318,7 +328,7 @@ class util
|
|
|
/**
|
|
|
* [getLock 时间锁]
|
|
|
* @param [type] $key [string]
|
|
|
- * @param integer $expire [time]
|
|
|
+ * @param integer $expire [time]
|
|
|
* @return [type] [bool]
|
|
|
*/
|
|
|
public static function getLock($key, $expire = 10)
|