Explorar o código

add debug-run logic

stanley-king %!s(int64=9) %!d(string=hai) anos
pai
achega
ec2bffbab6

+ 1 - 1
core/framework/cache/cache.redis.php

@@ -5,7 +5,7 @@
 
 defined('InShopNC') or exit('Access Invalid!');
 
-class CacheRedis extends Cache {
+class Cacheredis extends Cache {
 	private $config;
 	private $connected;
 	private $type;

+ 0 - 1
core/framework/function/build.php

@@ -1,7 +1,6 @@
 <?php
 /**
  * 压缩框架
- 
  */
 defined('InShopNC') or exit('Access Invalid!');
 /**

+ 17 - 9
core/framework/function/core.php

@@ -17,7 +17,8 @@ defined('InShopNC') or exit('Access Invalid!');
  * @param string $nchash 哈希数
  * @return string
  */
-function makeSeccode($nchash){
+function makeSeccode($nchash)
+{
 	$seccode = random(6, 1);
 	$seccodeunits = '';
 
@@ -76,7 +77,8 @@ function setNc2Cookie($name, $value, $expire='3600', $path='', $domain='', $secu
  * @param string $domain cookie 的域名
  * @param string $secure 是否通过安全的 HTTPS 连接来传输 cookie,默认为false
  */
-function setNcCookie($name, $value, $expire='3600', $path='', $domain='', $secure=false){
+function setNcCookie($name, $value, $expire='3600', $path='', $domain='', $secure=false)
+{
 	if (empty($path)) $path = '/';
 	if (empty($domain)) $domain = SUBDOMAIN_SUFFIX ? SUBDOMAIN_SUFFIX : '';
 	$name = defined('COOKIE_PRE') ? COOKIE_PRE.$name : strtoupper(substr(md5(MD5_KEY),0,4)).'_'.$name;
@@ -308,7 +310,8 @@ function getNchash($act = '', $op = ''){
  * @param string $key 密钥
  * @return string 返回加密结果
  */
-function encrypt($txt, $key = ''){
+function encrypt($txt, $key = '')
+{
 	if (empty($txt)) return $txt;
 	if (empty($key)) $key = md5(MD5_KEY);
 	$chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.";
@@ -348,7 +351,8 @@ function encrypt($txt, $key = ''){
  * @param string $key 密匙
  * @return string 字符串类型的返回结果
  */
-function decrypt($txt, $key = '', $ttl = 0){
+function decrypt($txt, $key = '', $ttl = 0)
+{
 	if (empty($txt)) return $txt;
 	if (empty($key)) $key = md5(MD5_KEY);
 
@@ -440,7 +444,8 @@ function Model($model = null, $base_path = null){
  * @param string $model 模型名称
  * @return obj 对象形式的返回结果
  */
-function Logic($model = null, $base_path = null){
+function Logic($model = null, $base_path = null)
+{
     static $_cache = array();
     $cache_key = $model.'.'.$base_path;
     if (!is_null($model) && isset($_cache[$cache_key])) return $_cache[$cache_key];
@@ -467,7 +472,8 @@ function Logic($model = null, $base_path = null){
  * @param string $path 路径
  * @return array 数组格式的返回结果
  */
-function readDirList($path){
+function readDirList($path)
+{
 	if (is_dir($path)) {
 		$handle = @opendir($path);
 		$dir_list = array();
@@ -492,7 +498,8 @@ function readDirList($path){
  * @param string $string 要转换的字符串
  * @return string 字符串类型的返回结果
  */
-function replaceSpecialChar($string){
+function replaceSpecialChar($string)
+{
 	$str = str_replace("\r\n", "", $string);
 	$str = str_replace("\t", "    ", $string);
 	$str = str_replace("\n", "", $string);
@@ -1193,17 +1200,18 @@ function import($libname,$file_ext='.php'){
 		$path = str_replace('#','.',$path);
 	}
 	//返回安全路径
+    
 	if(preg_match('/^[\w\d\/_.]+$/i', $path)){
-		$file = realpath($base_dir.$path.$file_ext);
+		$file = realpath($base_dir.$path.$file_ext);        
 	}else{
 		$file = false;
 	}
+    
 	if (!$file){
 		exit($path.$file_ext.' isn\'t exists!');
 	}else{
 		require_once($file);
 	}
-
 }
 
 /**

+ 4 - 3
core/framework/function/ftp.php

@@ -16,8 +16,8 @@ defined('InShopNC') or exit('Access Invalid!');
  * @param boolean $ifdel 是否删除本地图片,目前淘宝导入的图片上传到远程时,不会删除本地图片
  * @return string 远程图片路径部分
  */
-function remote_ftp($path, $file, $ifdel = true){
-
+function remote_ftp($path, $file, $ifdel = true)
+{
 	ftpcmd('upload', $path.'/'.$file);
 	$img_ext = explode(',', GOODS_IMAGES_EXT);
 	foreach ($img_ext as $val) {
@@ -36,7 +36,8 @@ function remote_ftp($path, $file, $ifdel = true){
 	return false;
 }
 
-function ftpcmd($cmd, $arg1 = '') {
+function ftpcmd($cmd, $arg1 = '') 
+{
 	import('libraries.ftp');
 	static $ftp;
 	$ftpon = C('ftp_open');

+ 5 - 3
core/framework/libraries/cache.php

@@ -6,8 +6,8 @@
  */
 defined('InShopNC') or exit('Access Invalid!');
 
-class Cache {
-
+class Cache 
+{
 	protected $params;
 	protected $enable;
 	protected $handler;
@@ -22,7 +22,9 @@ class Cache {
 	public function connect($type,$args = array()){
 		if (empty($type)) $type = C('cache_open') ? 'redis' : 'file';
 		$type = strtolower($type);
-		$class = 'Cache'.ucwords($type);
+		//$class = 'Cache'.ucwords($type);
+        
+        $class = ucwords($type);
 		if (!class_exists($class)){
 			import('cache.cache#'.$type);
 		}

+ 33 - 16
core/framework/libraries/language.php

@@ -8,7 +8,8 @@
  * @package    
  */
 defined('InShopNC') or exit('Access Invalid!');
-final class Language{
+final class Language
+{
 	private static $language_content = array();
 	
 	/**
@@ -17,11 +18,13 @@ final class Language{
 	 * @param array $key 数组
 	 * @return array 数组类型的返回结果
 	 */
-	public static function getGBK($key){
+	public static function getGBK($key)
+	{
 		/**
 		 * 转码
 		 */
-		if (strtoupper(CHARSET) == 'GBK' && !empty($key)){
+		if (strtoupper(CHARSET) == 'GBK' && !empty($key))
+		{
 			if (is_array($key)){
 				$result = var_export($key, true);//变为字符串
 				$result = iconv('UTF-8','GBK',$result);
@@ -38,11 +41,13 @@ final class Language{
 	 * @param array $key GBK编码数组
 	 * @return array 数组类型的返回结果
 	 */
-	public static function getUTF8($key){
+	public static function getUTF8($key)
+	{
 		/**
 		 * 转码
 		 */
-		if (!empty($key)){
+		if (!empty($key))
+		{
 			if (is_array($key)){
 				$result = var_export($key, true);//变为字符串
 				$result = iconv('GBK','UTF-8',$result);
@@ -59,9 +64,12 @@ final class Language{
 	 * @param string $key 数组下标
 	 * @return string 字符串形式的返回结果
 	 */
-	public static function get($key,$charset = ''){
+	public static function get($key,$charset = '')
+	{
 		$result = self::$language_content[$key] ? self::$language_content[$key] : '';
-		if (strtoupper(CHARSET) == 'UTF-8' || strtoupper($charset) == 'UTF-8') return $result;//json格式时不转换
+		if (strtoupper(CHARSET) == 'UTF-8' || strtoupper($charset) == 'UTF-8') {
+			return $result;//json格式时不转换
+		}
 		/**
 		 * 转码
 		 */
@@ -77,7 +85,8 @@ final class Language{
 	 * @param string $value 值
 	 * @return bool 字符串形式的返回结果
 	 */
-	public static function set($key,$value){
+	public static function set($key,$value) 
+	{
 		self::$language_content[$key] = $value;
 		return true;
 	}
@@ -87,14 +96,17 @@ final class Language{
 	 * @param string $file 语言包文件,可以按照逗号(,)分隔
 	 * @return bool 布尔类型的返回结果
 	 */
-	public static function read($file){
+	public static function read($file)
+    {
 		str_replace(',',',',$file);
 		$tmp = explode(',',$file);
-		foreach ($tmp as $v){
+		foreach ($tmp as $v)
+        {
 			$tmp_file = BASE_PATH.'/language/'.LANG_TYPE.DS.$v.'.php';
-			if (file_exists($tmp_file)){
+			if (file_exists($tmp_file))
+			{
 				require($tmp_file);
-				if (!empty($lang) && is_array($lang)){
+				if (!empty($lang) && is_array($lang)) {
 					self::$language_content = array_merge(self::$language_content,$lang);
 				}
 				unset($lang);
@@ -107,13 +119,17 @@ final class Language{
 	 *
 	 * @return array 数组类型的返回结果
 	 */
-	public static function getLangContent($charset = ''){
+	public static function getLangContent($charset = '')
+    {
 		$result = self::$language_content;
-		if (strtoupper(CHARSET) == 'UTF-8' || strtoupper($charset) == 'UTF-8') return $result;//json格式时不转换
+		if (strtoupper(CHARSET) == 'UTF-8' || strtoupper($charset) == 'UTF-8') {
+            return $result;//json格式时不转换
+        }
 		/**
 		 * 转码
 		 */
-		if (strtoupper(CHARSET) == 'GBK' && !empty($result)){
+		if (strtoupper(CHARSET) == 'GBK' && !empty($result))
+        {
 			if (is_array($result)){
 				foreach ($result as $k => $v){
 					$result[$k] = iconv('UTF-8','GBK',$v);
@@ -123,7 +139,8 @@ final class Language{
 		return $result;
 	}
 
-	public static function appendLanguage($lang){
+	public static function appendLanguage($lang)
+	{
 		if (!empty($lang) && is_array($lang)){
 			self::$language_content = array_merge(self::$language_content,$lang);
 		}

+ 6 - 6
data/config/config.ini.php

@@ -38,11 +38,11 @@ function config_init()
 	$ret['thumb']['impath'] = '';
 	$ret['cache']['type'] 			= 'file';
 
-	//$ret['redis']['prefix']      	= 'nc_';
-	//$ret['redis']['master']['port']     	= 6379;
-	//$ret['redis']['master']['host']     	= '127.0.0.1';
-	//$ret['redis']['master']['pconnect'] 	= 0;
-	//$ret['redis']['slave']      	    = array();
+	$ret['redis']['prefix']      	= 'nc_';
+	$ret['redis']['master']['port']     	= 6379;
+	$ret['redis']['master']['host']     	= '127.0.0.1';
+	$ret['redis']['master']['pconnect'] 	= 0;
+	$ret['redis']['slave']      	    = array();
 	//$ret['fullindexer']['open']      = false;
 	//$ret['fullindexer']['appname']   = '33hao';
 	
@@ -64,7 +64,7 @@ function config_init()
 	$ret['queue']['open'] = false;
 	$ret['queue']['host'] = '127.0.0.1';
 	$ret['queue']['port'] = 6379;
-	$ret['cache_open'] = false;
+	$ret['cache_open'] = true;
 	$ret['delivery_site_url']    = 'http://shopnc.yage.com/delivery';
 	
 	return $ret;

+ 92 - 54
data/model/member.model.php

@@ -5,12 +5,11 @@
  *
  *
  *
- 
  */
 defined('InShopNC') or exit('Access Invalid!');
-class memberModel extends Model {
-
-    public function __construct(){
+class memberModel extends Model 
+{
+    public function __construct() {
         parent::__construct('member');
     }
 
@@ -20,7 +19,8 @@ class memberModel extends Model {
      * @param string $field
      * @return array
      */
-    public function getMemberInfo($condition, $field = '*', $master = false) {
+    public function getMemberInfo($condition, $field = '*', $master = false) 
+    {
         return $this->table('member')->field($field)->where($condition)->master($master)->find();
     }
 
@@ -31,7 +31,8 @@ class memberModel extends Model {
      * @param string $field 需要取得的缓存键值, 例如:'*','member_name,member_sex'
      * @return array
      */
-    public function getMemberInfoByID($member_id, $fields = '*') {
+    public function getMemberInfoByID($member_id, $fields = '*')
+    {
         $member_info = rcache($member_id, 'member', $fields);
         if (empty($member_info)) {
             $member_info = $this->getMemberInfo(array('member_id'=>$member_id),'*',true);
@@ -47,7 +48,8 @@ class memberModel extends Model {
      * @param number $page
      * @param string $order
      */
-    public function getMemberList($condition = array(), $field = '*', $page = 0, $order = 'member_id desc', $limit = '') {
+    public function getMemberList($condition = array(), $field = '*', $page = 0, $order = 'member_id desc', $limit = '')
+    {
        return $this->table('member')->where($condition)->page($page)->order($order)->limit($limit)->select();
     }
 
@@ -65,7 +67,8 @@ class memberModel extends Model {
      * @param array $condition
      * @param array $data
      */
-    public function editMember($condition, $data) {
+    public function editMember($condition, $data) 
+    {
         $update = $this->table('member')->where($condition)->update($data);
         if ($update && $condition['member_id']) {
             dcache($condition['member_id'], 'member');
@@ -78,7 +81,8 @@ class memberModel extends Model {
      *
      * @param array $member_info 会员信息
      */
-    public function createSession($member_info = array(),$reg = false) {
+    public function createSession($member_info = array(),$reg = false) 
+    {
         if (empty($member_info) || !is_array($member_info)) return ;
 
 		$_SESSION['is_login']	= '1';
@@ -105,7 +109,8 @@ class memberModel extends Model {
 		    $this->addExppoint($member_info);		    
 		}
 
-		if(!empty($member_info['member_login_time'])) {
+		if(!empty($member_info['member_login_time'])) 
+		{
             $update_info	= array(
                 'member_login_num'=> ($member_info['member_login_num']+1),
                 'member_login_time'=> TIMESTAMP,
@@ -120,12 +125,12 @@ class memberModel extends Model {
     }
 	/**
 	 * 获取会员信息
-	 *
 	 * @param	array $param 会员条件
 	 * @param	string $field 显示字段
 	 * @return	array 数组格式的返回结果
 	 */
-	public function infoMember($param, $field='*') {
+	public function infoMember($param, $field='*') 
+	{
 		if (empty($param)) return false;
 
 		//得到条件语句
@@ -137,7 +142,8 @@ class memberModel extends Model {
 		$param['limit'] = 1;
 		$member_list	= Db::select($param);
 		$member_info	= $member_list[0];
-		if (intval($member_info['store_id']) > 0){
+		if (intval($member_info['store_id']) > 0)
+		{
 	      $param	= array();
 	      $param['table']	= 'store';
 	      $param['field']	= 'store_id';
@@ -155,7 +161,8 @@ class memberModel extends Model {
     /**
      * 注册
      */
-    public function register($register_info) {
+    public function register($register_info) 
+    {
 		// 注册验证
 		$obj_validate = new Validate();
 		$obj_validate->validateparam = array(
@@ -188,9 +195,10 @@ class memberModel extends Model {
 		//添加邀请人(推荐人)会员积分 by abc.com
 		$member_info['inviter_id']		= $register_info['inviter_id'];
 		$insert_id	= $this->addMember($member_info);
-		if($insert_id) {
+		if($insert_id) 
+		{
 		    //添加会员积分
-			if (C('points_isuse')){
+			if (C('points_isuse')) {
 				Model('points')->savePointsLog('regist',array('pl_memberid'=>$insert_id,'pl_membername'=>$register_info['username']),false);
 				//添加邀请人(推荐人)会员积分 by abc.com
 				$inviter_name = Model('member')->table('member')->getfby_member_id($member_info['inviter_id'],'member_name');
@@ -216,39 +224,55 @@ class memberModel extends Model {
 
     }
 
+    private function empty_model($param)
+	{
+		$member = array();
+
+		$passwd = trim($param['member_passwd']);
+		$member['member_passwd'] = empty($passwd) ? $passwd : md5($passwd);
+
+		$member['member_time']			= TIMESTAMP;
+		$member['member_login_time'] 	= TIMESTAMP;
+		$member['member_old_login_time'] = TIMESTAMP;
+		$member['member_login_ip']		= getIp();
+		$member['member_old_login_ip']	= $member['member_login_ip'];
+        
+        return $member;
+	}
+
 	/**
 	 * 注册商城会员
 	 *
 	 * @param	array $param 会员信息
 	 * @return	array 数组格式的返回结果
 	 */
-	public function addMember($param) {
+	public function addMember($param) 
+	{
 		if(empty($param)) {
 			return false;
 		}
-		try {
+
+		try 
+		{
 		    $this->beginTransaction();
-		    $member_info	= array();
-		    $member_info['member_id']			= $param['member_id'];
-		    $member_info['member_name']			= $param['member_name'];
-		    $member_info['member_passwd']		= md5(trim($param['member_passwd']));
-		    $member_info['member_email']		= $param['member_email'];
-		    $member_info['member_time']			= TIMESTAMP;
-		    $member_info['member_login_time'] 	= TIMESTAMP;
-		    $member_info['member_old_login_time'] = TIMESTAMP;
-		    $member_info['member_login_ip']		= getIp();
-		    $member_info['member_old_login_ip']	= $member_info['member_login_ip'];
-
-		    $member_info['member_truename']		= $param['member_truename'];
-		    $member_info['member_qq']			= $param['member_qq'];
-		    $member_info['member_sex']			= $param['member_sex'];
-		    $member_info['member_avatar']		= $param['member_avatar'];
-		    $member_info['member_qqopenid']		= $param['member_qqopenid'];
-		    $member_info['member_qqinfo']		= $param['member_qqinfo'];
-		    $member_info['member_sinaopenid']	= $param['member_sinaopenid'];
-		    $member_info['member_sinainfo']	= $param['member_sinainfo'];
-		    //添加邀请人(推荐人)会员积分 by abc.com
-		    $member_info['inviter_id']	        = $param['inviter_id'];
+		    $member_info = $this->empty_model($param);
+            
+            foreach ($param as $key => $value)
+            {
+                if($key == 'member_passwd') {
+                    $passwd = trim($param['member_passwd']);
+                    $member_info['member_passwd'] = empty($passwd) ? $passwd : md5($passwd);
+                } elseif($key == 'member_time') {
+                    $member_info['member_time'] = TIMESTAMP;
+                } elseif($key == 'member_login_time') {
+                    $member_info['member_login_time'] = TIMESTAMP;
+                } elseif($key == 'member_login_ip') {
+                    $member_info['member_login_ip'] = getIp();
+                } else {
+                    $member_info[$key] = $value;
+                }
+            }
+            
 		    $insert_id	= $this->table('member')->insert($member_info);
 		    if (!$insert_id) {
 		        throw new Exception();
@@ -269,7 +293,8 @@ class memberModel extends Model {
 	 * 会员登录检查
 	 *
 	 */
-	public function checkloginMember() {
+	public function checkloginMember() 
+	{
 		if($_SESSION['is_login'] == '1') {
 			@header("Location: index.php");
 			exit();
@@ -280,7 +305,8 @@ class memberModel extends Model {
 	 * 检查会员是否允许举报商品
 	 *
 	 */
-	public function isMemberAllowInform($member_id) {
+	public function isMemberAllowInform($member_id)
+	{
         $condition = array();
         $condition['member_id'] = $member_id;
         $member_info = $this->getMemberInfo($condition,'inform_allow');
@@ -297,7 +323,8 @@ class memberModel extends Model {
 	 * @param unknown $condition
 	 * @param string $fields
 	 */
-	public function getMemberCommonInfo($condition = array(), $fields = '*') {
+	public function getMemberCommonInfo($condition = array(), $fields = '*') 
+	{
 	    return $this->table('member_common')->where($condition)->field($fields)->find();
 	}
 
@@ -306,7 +333,8 @@ class memberModel extends Model {
 	 * @param unknown $data
 	 * @return Ambigous <mixed, boolean, number, unknown, resource>
 	 */
-	public function addMemberCommon($data) {
+	public function addMemberCommon($data) 
+	{
 	    return $this->table('member_common')->insert($data);
 	}
 
@@ -316,7 +344,8 @@ class memberModel extends Model {
 	 * @param unknown $condition
 	 * @return Ambigous <mixed, boolean, number, unknown, resource>
 	 */
-	public function editMemberCommon($data,$condition) {
+	public function editMemberCommon($data,$condition) 
+	{
 	    return $this->table('member_common')->where($condition)->update($data);
 	}
 
@@ -324,7 +353,8 @@ class memberModel extends Model {
 	 * 添加会员积分
 	 * @param unknown $member_info
 	 */
-	public function addPoint($member_info) {
+	public function addPoint($member_info) 
+	{
 	    if (!C('points_isuse') || empty($member_info)) return;
 	
 	    //一天内只有第一次登录赠送积分
@@ -341,7 +371,8 @@ class memberModel extends Model {
 	 * 添加会员经验值
 	 * @param unknown $member_info
 	 */
-	public function addExppoint($member_info) {
+	public function addExppoint($member_info) 
+	{
 	    if (empty($member_info)) return;
 
 	    //一天内只有第一次登录赠送经验值
@@ -358,7 +389,8 @@ class memberModel extends Model {
 	 * 取得会员安全级别
 	 * @param unknown $member_info
 	 */
-	public function getMemberSecurityLevel($member_info = array()) {
+	public function getMemberSecurityLevel($member_info = array()) 
+	{
 	    $tmp_level = 0;
 	    if ($member_info['member_email_bind'] == '1') {
 	        $tmp_level += 1;
@@ -378,10 +410,12 @@ class memberModel extends Model {
 	 * @param int $exppoints  会员经验值
 	 * @param array $cur_level 会员当前等级
 	 */
-	public function getMemberGradeArr($show_progress = false,$exppoints = 0,$cur_level = ''){
+	public function getMemberGradeArr($show_progress = false,$exppoints = 0,$cur_level = '')
+	{
 	    $member_grade = C('member_grade')?unserialize(C('member_grade')):array();
 	    //处理会员等级进度
-	    if ($member_grade && $show_progress){
+	    if ($member_grade && $show_progress)
+	    {
 	        $is_max = false;
 	        if ($cur_level === ''){
 	            $cur_gradearr = $this->getOneMemberGrade($exppoints, false, $member_grade);
@@ -402,7 +436,8 @@ class memberModel extends Model {
 	 * @param	array $conditon_array
 	 * @return	string
 	 */
-	private function getCondition($conditon_array){
+	private function getCondition($conditon_array)
+	{
 		$condition_sql = '';
 		if($conditon_array['member_id'] != '') {
 			$condition_sql	.= " and member_id= '" .intval($conditon_array['member_id']). "'";
@@ -484,7 +519,8 @@ class memberModel extends Model {
 	 * @param bool $show_progress 是否计算其当前等级进度
 	 * @param array $member_grade 会员等级
 	 */
-	public function getOneMemberGrade($exppoints,$show_progress = false,$member_grade = array()){
+	public function getOneMemberGrade($exppoints,$show_progress = false,$member_grade = array())
+	{
 	    if (!$member_grade){
 	        $member_grade = C('member_grade')?unserialize(C('member_grade')):array();
 	    }
@@ -497,7 +533,8 @@ class memberModel extends Model {
 	    $exppoints = intval($exppoints);
 	    
 	    $grade_arr = array();
-	    if ($member_grade){
+	    if ($member_grade)
+	    {
 		    foreach ($member_grade as $k=>$v){
 		        if($exppoints >= $v['exppoints']){
 		            $grade_arr = $v;
@@ -505,8 +542,9 @@ class memberModel extends Model {
 			}
 		}
 		//计算提升进度
-		if ($show_progress == true){
-		    if (intval($grade_arr['level']) >= (count($member_grade) - 1)){//如果已达到顶级会员
+		if ($show_progress == true)
+		{
+		    if (intval($grade_arr['level']) >= (count($member_grade) - 1)) {//如果已达到顶级会员
 		        $grade_arr['downgrade'] = $grade_arr['level'] - 1;//下一级会员等级
 		        $grade_arr['downgrade_name'] = $member_grade[$grade_arr['downgrade']]['level_name'];
 		        $grade_arr['downgrade_exppoints'] = $member_grade[$grade_arr['downgrade']]['exppoints'];

+ 0 - 1
data/model/store_class.model.php

@@ -5,7 +5,6 @@
  * 
  *
  *
- 
  */
 defined('InShopNC') or exit('Access Invalid!');
 

+ 0 - 1
data/model/store_msg_read.model.php

@@ -2,7 +2,6 @@
 /**
  * 店铺消息阅读模板模型
  *
- 
  */
 defined('InShopNC') or exit('Access Invalid!');
 class store_msg_readModel extends Model{

+ 9 - 9
debug_run.php

@@ -3,18 +3,18 @@
 printf("Content-Type: text/html; charset=UTF-8\r\n\r\n");
 
 $reqs = array();
-$uri ='http://localhost:8080/mobile/index.php?act=index&op=index';
+//$reqs['index'] ='http://localhost:8080/mobile/index.php?act=index&op=index';
+//$reqs['login_register'] ='http://localhost:8080/mobile/index.php?act=login&op=register&username=stanley&password=55668899&password_confirm=55668899&';
+$reqs['login_genanonymous'] ='http://localhost:8080/mobile/index.php?act=login&op=genanonymous&info=helloworld';
 
-echo ' 0 <br>';
 
-array_push($reqs, $uri);
-array_push($reqs, $uri);
-array_push($reqs, $uri);
-
-echo ' 1 <br>';
-
-foreach ($reqs as $val)
+foreach ($reqs as $key => $uri )
 {    
+    define('StartTime', microtime(true));
+    define('TIMESTAMP', time());
+    
+    echo $key;
+    
     $lreq = new local_request($uri);    
     init_localreq($lreq);
     

+ 1 - 0
fcgi_run.php

@@ -5,6 +5,7 @@ while(($ret = fcgi_accept()) >= 0)
 {    
     define('StartTime',microtime(true));
     define('TIMESTAMP',time());
+    
 
     printf("Content-Type: text/html; charset=UTF-8\r\n\r\n");    
     echo fcgi_getparam('SCRIPT_FILENAME') . '<br>';

+ 7 - 6
install/data/config.ini.php

@@ -32,11 +32,12 @@ $config['cookie_pre'] 		= '===cookie_pre===';
 $config['thumb']['cut_type'] = 'gd';
 $config['thumb']['impath'] = '';
 $config['cache']['type'] 			= 'file';
-//$config['redis']['prefix']      	= 'nc_';
-//$config['redis']['master']['port']     	= 6379;
-//$config['redis']['master']['host']     	= '127.0.0.1';
-//$config['redis']['master']['pconnect'] 	= 0;
-//$config['redis']['slave']      	    = array();
+
+$config['redis']['prefix']      	= 'nc_';
+$config['redis']['master']['port']     	= 6379;
+$config['redis']['master']['host']     	= '127.0.0.1';
+$config['redis']['master']['pconnect'] 	= 0;
+$config['redis']['slave']      	    = array();
 //$config['fullindexer']['open']      = false;
 //$config['fullindexer']['appname']   = '33hao';
 $config['debug'] 			= false;
@@ -57,6 +58,6 @@ $config['sms']['sessionKey'] = '';
 $config['queue']['open'] = false;
 $config['queue']['host'] = '127.0.0.1';
 $config['queue']['port'] = 6379;
-$config['cache_open'] = false;
+$config['cache_open'] = true;
 $config['delivery_site_url']    = '===url===/delivery';
 return $config;

+ 4 - 5
mobile/control/control.php

@@ -3,7 +3,6 @@
  * mobile父类
  *
  *
- 
  */
 
 //use Shopnc\Tpl;
@@ -12,9 +11,9 @@ defined('InShopNC') or exit('Access Invalid!');
 
 /********************************** 前台control父类 **********************************************/
 
-class mobileControl{
-
-    //客户端类型
+class mobileControl
+{
+   //客户端类型
     protected $client_type_array = array('android', 'wap', 'wechat', 'ios');
     //列表默认分页数
     protected $page = 5;
@@ -22,7 +21,7 @@ class mobileControl{
 
 	public function __construct() {
         Language::read('mobile');
-
+        
         //分页数处理
         $page = intval($_GET['page']);
         if($page > 0) {

+ 4 - 6
mobile/control/goods.php

@@ -10,8 +10,8 @@
 //use Shopnc\Tpl;
 
 defined('InShopNC') or exit('Access Invalid!');
-class goodsControl extends mobileHomeControl{
-
+class goodsControl extends mobileHomeControl
+{
 	public function __construct() {
         parent::__construct();
     }
@@ -19,7 +19,8 @@ class goodsControl extends mobileHomeControl{
     /**
      * 商品列表
      */
-    public function goods_listOp() {
+    public function goods_listOp() 
+    {
         $model_goods = Model('goods');
         $model_search = Model('search');
 
@@ -223,9 +224,6 @@ class goodsControl extends mobileHomeControl{
 		}
 		$goods_detail['IsHaveBuy']=$IsHaveBuy;
 		//v3-b11 end
-		
-		
-		
 
         output_data($goods_detail);
     }

+ 112 - 15
mobile/control/login.php

@@ -5,50 +5,123 @@
  *
  *
  *
- 
  */
 
 //use Shopnc\Tpl;
 
 defined('InShopNC') or exit('Access Invalid!');
 
-class loginControl extends mobileHomeControl {
+class loginControl extends mobileHomeControl 
+{
+    const mobile_login = 0;
+    const anonymous_login = 1;
+    const wxopen_login = 2;
 
 	public function __construct(){
 		parent::__construct();
 	}
 
+    private function authen()
+    {
+
+    }
+    
 	/**
 	 * 登录
 	 */
-	public function indexOp(){
-        if(empty($_POST['username']) || empty($_POST['password']) || !in_array($_POST['client'], $this->client_type_array)) {
+    
+	public function indexOp()
+    {
+        if(!in_array($_POST['client'], $this->client_type_array)) {
             output_error('登录失败');
+            return;
         }
 
-		$model_member = Model('member');
+        $type = $_POST['type']; 
+        $authenid = $_POST['authenid']; 
+
+        $array = array();   
+        if($type == mobile_login) 
+        {
+            $array['member_mobile'] = $authenid;
+
+            if(empty($authenid) || empty($_POST['password']))  {
+                output_error('登录失败');
+                return;
+            }
+        } 
+        elseif($type == anonymous_login) 
+        {
+            $array['member_mobile'] = $authenid;
+            if(empty($authenid)) {
+
+            }
+        } 
+        elseif($type == wxopen_login) 
+        {
 
-        $array = array();
-        $array['member_name']	= $_POST['username'];
-        $array['member_passwd']	= md5($_POST['password']);
+        } 
+        else 
+        {
+
+        }
+        
+		$model_member = Model('member');
         $member_info = $model_member->getMemberInfo($array);
 
-        if(!empty($member_info)) {
+        if(!empty($member_info)) 
+        {
             $token = $this->_get_token($member_info['member_id'], $member_info['member_name'], $_POST['client']);
             if($token) {
                 output_data(array('username' => $member_info['member_name'], 'key' => $token));
             } else {
                 output_error('登录失败');
             }
-        } else {
+        } 
+        else {
             output_error('用户名密码错误');
         }
     }
 
+    public function genanonymousOp()
+    {
+        $info = $_POST['info'];
+        if(empty($info)) {
+            output_error('获取匿名身份失败.');
+        }
+        else 
+        {
+            $anonymous_id = md5($info);
+            $model_member = Model('member');
+            
+            $conditions = array();
+            $conditions['anonymous_id'] = $anonymous_id;
+            
+            $user = $model_member->getMemberInfo($conditions,'member_id');
+            if(empty($user)) 
+            {
+                $conditions['member_name'] = 'anonymous';
+                $conditions['member_type'] = anonymous_login;
+                $ret = $model_member->addMember($conditions);
+                if($ret != false) {
+                    output_error('获取匿名身份失败.');
+                } else {
+                    $json = array('userid' => $anonymous_id);
+
+                }
+            }
+            else 
+            {
+
+            }
+        }
+    }
+
     /**
      * 登录生成token
      */
-    private function _get_token($member_id, $member_name, $client) {
+    private function _get_token($member_id, $member_name, $client) 
+    {
         $model_mb_user_token = Model('mb_user_token');
 
         //重新登录后以前的令牌失效
@@ -74,22 +147,47 @@ class loginControl extends mobileHomeControl {
         } else {
             return null;
         }
+    }
+
+
+    /**
+	 * 获取验证码
+	 */
 
+    private function gencheckcode()
+    {
+        return '1234';
     }
 
-	/**
+    private function send_sms($phone,$code,$type)
+    {
+
+    }
+
+    public function chekcodeOp() {
+        $phone = $_POST['phonenumber'];
+        $code = gencheckcode();
+        send_sms($phone,$code,1);
+    }
+   
+    /**
 	 * 注册
 	 */
-	public function registerOp(){
+	public function registerOp()
+    {
 		$model_member	= Model('member');
 
         $register_info = array();
         $register_info['username'] = $_POST['username'];
         $register_info['password'] = $_POST['password'];
         $register_info['password_confirm'] = $_POST['password_confirm'];
+
+        $register_info['checkcode'] = $_POST['password_confirm'];
         $register_info['email'] = $_POST['email'];
+        
         $member_info = $model_member->register($register_info);
-        if(!isset($member_info['error'])) {
+        if(!isset($member_info['error'])) 
+        {
             $token = $this->_get_token($member_info['member_id'], $member_info['member_name'], $_POST['client']);
             if($token) {
                 output_data(array('username' => $member_info['member_name'], 'key' => $token));
@@ -99,6 +197,5 @@ class loginControl extends mobileHomeControl {
         } else {
 			output_error($member_info['error']);
         }
-
     }
 }

+ 2 - 3
mobile/control/store.php

@@ -4,11 +4,10 @@
  *
  *
  *
- 
  */
 defined('InShopNC') or exit('Access Invalid!');
-class storeControl extends mobileHomeControl{
-
+class storeControl extends mobileHomeControl
+{
 	public function __construct() {
         parent::__construct();
     }

+ 4 - 3
queue/control/index.php

@@ -9,15 +9,16 @@
 */
 defined('InShopNC') or exit('Access Invalid!');
 
-class indexControl {
-
+class indexControl 
+{
     public function queueOp() {
         if (ob_get_level()) ob_end_clean();
 
         $model_queue = Model('queue',BASE_PATH);
 
         $worker = new QueueServer();
-        while (true) {
+        while (true) 
+        {
             $list_key = $worker->scan();
             if (!empty($list_key) && is_array($list_key)) {
                 foreach ($list_key as $key) {

+ 6 - 9
request_helper.php

@@ -147,17 +147,14 @@ function init_localreq(local_request $req)
     $params = preg_split('/&|=/', $squery);
     $method = strtolower($req->method());
 
-    if($method == 'get' ) 
+    if($method == 'get' || $method == 'post') 
     { 
         for($i = 0; $i < count($params); ++$i) { 
-            $_GET[ $params[$i] ] = $params[++$i];            
-        }        
-    }
-    elseif($method == 'post') 
-    {
-        for($i = 0; $i < count($params); ++$i) { 
-            $_POST[ $params[$i] ] = $params[++$i];            
+            $key = $params[$i];
+            $val = $params[++$i];
+            $_GET[$key] = $val;    
+            $_POST[$key] = $val;
         }        
-    }    
+    } 
 }
 

+ 3 - 1
research_run.php

@@ -5,7 +5,9 @@
 Base::run_test();
 
 
-include BASE_ROOT_PATH . "/research/db.php";
+//include BASE_ROOT_PATH . "/research/db.php";
+include BASE_ROOT_PATH . "/research/function_test.php";
+
 
 
 

+ 3 - 3
run.php

@@ -18,6 +18,7 @@ require_once(BASE_CORE_PATH.'/framework/libraries/queue.php');
 require_once(BASE_CORE_PATH.'/framework/libraries/tpl.php');
 require_once(BASE_CORE_PATH.'/framework/function/core.php');
 require_once(BASE_CORE_PATH.'/framework/core/base.php');
+require_once(BASE_CORE_PATH.'/framework/libraries/cache.php');
 require_once(BASE_CORE_PATH.'/framework/libraries/queue.php');
 require_once(BASE_CORE_PATH.'/framework/libraries/language.php');
 require_once(BASE_CORE_PATH.'/framework/libraries/model.php');
@@ -32,15 +33,14 @@ $gfcgi_run = 1;
 
 $log_file = new SplFileObject('/Users/stanley-king/logs/php_example.txt','w+');
 
-if($gfcgi_run == 0) {
+if($gfcgi_run == 0) { //正式的请求处理程序
     $file = BASE_ROOT_PATH . '/fcgi_run.php';
     @include $file;
-} elseif($gfcgi_run == 1) {
+} elseif($gfcgi_run == 1) { //模拟请求
     $file = BASE_ROOT_PATH . '/debug_run.php';   
     include $file;
 } else {
     $file = BASE_ROOT_PATH . '/research_run.php';   
     include $file;
 }
-
 ?>